Search

retrieve the IP address of the Host PC

This C# code snippet allows the user to retrieve the IP address of the Host PC.

using System.Net;
...
String strHostName  = Dns.GetHostName();
IPHostEntry ipEntry = Dns.GetHostEntry(strHostName);
IPAddress[] addr    = ipEntry.AddressList;