取得IP地址
using System; using System.Net; class GetIP { public static void Main() { IPHostEntry ipEntry = Dns.GetHostByName (localhost); IPAddress [] IpAddr = ipEntry.AddressList; for (int i = 0; i < IpAddr.Length; i++) { Console.WriteLine (IP Address {0}: {1} , i, IpAddr.ToString ()); } } }