C#ping网络IP实现网络状态检测的方法
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; } }
上述就是C#学习教程:C# ping网络IP 实现网络状态检测的方法分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/cdevelopment/907494.html
赞 (0)