Search code examples
c#.netiparp

How to create static ARP cache entries programatically in Windows XP


Is there are way to set ARP cache entry in C#?

The only way I have found is related to use of arp utility Address Resolution Protocol

Static entries added with the arp -s command are not expired from the cache.

There are related post about How do I access ARP-protocol information through .NET?


Solution

  • It wouldn't be purely .NET obviously, but you should be able to do it via the Win32 API in the IP Helper API library - namely the CreateIpNetEntry and SetIpNetEntry methods. You would likely want to do this via P/Invoke or a wrapped managed C++ library.

    http://msdn.microsoft.com/en-us/library/aa366071(v=vs.85).aspx