Is there any way to create ARP cache entries programatically in windows using java?

StackOverflow https://stackoverflow.com/questions/15271161

  •  18-03-2022
  •  | 
  •  

I want to add arp ip to mac mapping to arp cache using programming languages preferably java.

有帮助吗?

解决方案

You can simply run the command ARP -s inet_addr eth_adr where inet_addr is the IP address and eth_adr is the hardware address.
In Java:

 Process child = Runtime.getRuntime().exec("arp -s 220.0.0.161 00-50-04-62-F7-23");

In c#:

 Process process = new Process();
 process.StartInfo.FileName = "arp -s 220.0.0.161 00-50-04-62-F7-23";
 process.StartInfo.CreateNoWindow = true; //Don't show window
 process.Start();
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top