当我使用 windows 操作系统时,它说没有回应,但是当我使用 c # 操作系统时,它说成功了。Windows 正确,设备未连接。为什么我的代码能够成功地 ping,而 Windows 不能?
这是我的代码:
Ping p1 = new Ping();
PingReply PR = p1.Send("192.168.2.18");
// check when the ping is not success
while (!PR.Status.ToString().Equals("Success"))
{
Console.WriteLine(PR.Status.ToString());
PR = p1.Send("192.168.2.18");
}
// check after the ping is n success
while (PR.Status.ToString().Equals("Success"))
{
Console.WriteLine(PR.Status.ToString());
PR = p1.Send("192.168.2.18");
}