string hostname = System.Net.Dns.GetHostName(); System.Net.IPHostEntry ipEntry=System.Net.Dns.GetHostByName(hostname);