111,129
社区成员
发帖
与我相关
我的任务
分享
public bool PingTest(string strIp, int iTimeout)
{
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingReply res;
try
{
res = ping.Send(strIp, iTimeout);
if (res.Status == System.Net.NetworkInformation.IPStatus.Success)
{
return true;
}
else
{
return false;
}
}
catch (Exception)
{
return false;
}
}