-1

I have two network interface cards installed in my system, I want the list of all the computers that are connected to a particular NIC card or I need a code that will work similar to "arp -a" command in DOS. I need a C# code to do this. Please help me.

  • I think you would have to write a C-Interface to access the hardware information. Unless you can read pings. – OmniOwl Jun 12 '13 at 22:27

1 Answers1

1

If all you want is the output from arp -a then this is simple :

Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.FileName = "arp.exe";
p.StartInfo.Arguments = "-a";
p.Start();

string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();

MessageBox.Show(output);  //etc... parse this for what you need

You will of course need to add :

using System.Diagnostics;
J...
  • 30,968
  • 6
  • 66
  • 143