string name = System.Net.Dns.GetHostName(); host = System.Net.Dns.GetHostEntry(name); System.Net.IPAddress ip = host.AddressList.Where(n => n.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).First();