Is there a way to find mapping between MAC address to IP address in C#. i think RARP should be able to do that, is there an API available in C# for that
+1
A:
Why not spawn a process to invoke rarp and read in the input stream from the process's output? That's a real cheap simple and cheerful way of doing it...top-of-my-head, it goes something like this:
System.Diagnostics.ProcessStartInfo ps = new System.Diagnostics.ProcessStartInfo("arp", "-a");
ps.CreateNoWindow = false;
ps.RedirectStandardOutput = true;
using (System.Diagnostics.Process proc = new System.Diagnostics.Process())
{
proc.StartInfo = ps;
proc.Start();
System.IO.StreamReader sr = proc.StandardOutput;
while (!proc.HasExited) ;
string sResults = sr.ReadToEnd();
}
Then it's a matter of parsing the sResults to get the MAC address.
Hope this helps, Best regards, Tom.
tommieb75
2010-02-05 01:11:58
A:
In case you are looking for an API based approach and are not able to do a Process.Start() take a look at this:
http://www.codeproject.com/KB/IP/host_info_within_network.aspx
It allows mapping of hostname, IP address and MAC address.
Regards Rahul
Rahul Singh
2010-02-05 05:11:48