1 //根据域名解析出IP 2 IPHostEntry hostinfo = Dns.GetHostByName("baidu.com"); 3 IPAddress[] aryIP = hostinfo.AddressList; 4 IPAddress address = aryIP[0];