0

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

Romil Shah
  • 95
  • 8
  • Actually i didnt found any way rather just a trick that we can write strings to command promt using java so we can write arp -s http://stackoverflow.com/questions/4688123/how-to-open-the-command-prompt-and-insert-commands-using-java http://viralpatel.net/blogs/how-to-execute-command-prompt-command-view-output-java/ – Romil Shah Mar 07 '13 at 13:44

1 Answers1

1

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();
Orestis P.
  • 805
  • 7
  • 27