Monday, July 9, 2007

How to Get the IP address of the Host PC.

This C# code snippet allows you 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;

No comments: