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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top