Is this possible?
I understand that I can launch command prompt using Visual C#:
What i'd really like to do is run the ping command behind the scenes, and capture the results to a string. The aim is to basically get hold of the IP address of the user.
This is my plan:
ping -r 2 routehiker.org.uk
capture the results
select all the (up to 9) IP addresses in to an array
scan the array for the first IP Address that doesn't begin with the following (they are all reserved for local networks):
10.
172.16.
192.168.
169.254.
Alternatively, is there a better method for finding the true IP of the user running the program?
I understand that I can launch command prompt using Visual C#:
Code:
System.Diagnostics.Process process1;
process1= new System.Diagnostics.Process();
//Do not receive an event when the process exits.
process1.EnableRaisingEvents = false;
//The "/C" Tells Windows to Run The Command then Terminate
string strCmdLine;
strCmdLine = "/C ping -r 2 routehiker.org.uk";
System.Diagnostics.Process.Start("cmd.exe",strCmdLine);
process1.Close();
What i'd really like to do is run the ping command behind the scenes, and capture the results to a string. The aim is to basically get hold of the IP address of the user.
This is my plan:
ping -r 2 routehiker.org.uk
capture the results
select all the (up to 9) IP addresses in to an array
scan the array for the first IP Address that doesn't begin with the following (they are all reserved for local networks):
10.
172.16.
192.168.
169.254.
Alternatively, is there a better method for finding the true IP of the user running the program?