string hostname = System.Net.Dns.GetHostName();

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





本文转载:CSDN博客