Get Device IP?

  • Thread starter Thread starter Guest
  • Start date Start date
using System.Net;

....

string hostName = Dns.GetHostName();

IPHostEntry thisHost = Dns.GetHostEntry(hostName);

string thisIpAddr = thisHost.AddressList[0].ToString();



Dex
 
Thanks, it works
but I have a strange situation:
When I run this code in a new windows form application it work fine.
When I run this code in my application I get a message from VS2005: "The
connection with the device lost"

any idea?





Dexlex said:
using System.Net;

....

string hostName = Dns.GetHostName();

IPHostEntry thisHost = Dns.GetHostEntry(hostName);

string thisIpAddr = thisHost.AddressList[0].ToString();



Dex





Ofer B. said:
Hello,

How can I get the device IP using C#?

Thanks
 
Back
Top