硬件系统集成中,经常需要查看设备网络是否通,此时就需要我们测试网络
public bool PingIp(string strIP)
{
bool bRet = false;
try
{
Ping pingSend = new Ping();
PingReply reply = pingSend.Send(strIP, 1000);
if (reply.Status == IPStatus.Success)
bRet = true;
}
catch (Exception)
{
bRet = false;
}
return bRet;
}