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