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