0

This has an answer for Win XP but In Windows 7 and later the arp command can't setup static links, you need to use netsh, also it requires that I know the MAC address. What I want to do (similar to the ARM library) is to tell Windows to keep an IP address to MAC entry in the ARP table refreshed. I would like to do this in C# or C++/CLI. Is there an Ethernet level call I can make or must I do a system call via netsh?

As background, I have a .NET program (mix of C# and C++/CLI) that talks to more than a hundred IP devices over UDP on a local subnet. I actually know all the IP and MAC addresses ahead of time so I would like to configure the ARP cache to not throw away the first packet waiting for ARP resolution the first time I send to an IP address. Also it appears if you don't make them static the timeout is around 150 seconds so after that period you lose another packet refreshing the ARP table.

bd2357
  • 704
  • 9
  • 17
  • Don't keep us guessing! You say that you know the Windows XP answer for this: what is it, have you tried it on Windows 7, and how did it not work? – David Yaw Jun 13 '16 at 22:55
  • WinXP answer was here: http://stackoverflow.com/questions/3893816/how-to-create-static-arp-cache-entries-programatically-in-windows-xp?rq=1 – bd2357 Jun 14 '16 at 16:56
  • I took a quick glance at the MSDN pages linked from that answer; I don't see any notes about those APIs not working in Windows 7. What happens when you try solution that on Win 7? – David Yaw Jun 14 '16 at 17:01
  • If you do it from regular cmd it says that it required elevation. If you do it from admin run cmd it fails silent. This is a common reference: https://support.microsoft.com/en-us/kb/949589 . I can still do it from system command wrapper using netsh, but this seems clunky. – bd2357 Jun 14 '16 at 17:22

0 Answers0