C#通过域名获得IP地址的代码
-
- using System.Net;
- string web = txtWeb.Text;
- IPHostEntry host = Dns.GetHostByName(web);
- IPAddress ip = host.AddressList[0];
- txtIp.Text = ip.ToString();
- //该片段来自于http://www.codesnippet.cn/detail/020820134938.html
来源: http://www.codesnippet.cn/detail/020820134938.html