- public string GetHostNameByIp(string ip)
- {
- ip = ip.Trim();
- if (ip == string.Empty)
- return string.Empty;
- try
- {
- // 是否 Ping 的通
- if (this.Ping(ip))
- {
- System.Net.IPHostEntry host = System.Net.Dns.GetHostEntry(ip);
- return host.HostName;
- }
- else
- return string.Empty;
- }
- catch (Exception)
- {
- return string.Empty;
- }
- }
版权声明:本文为szstephenzhou原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。