【发布时间】:2015-10-21 22:45:38
【问题描述】:
我正在使用 System.Net.NetworkInformation 库来 ping IP 地址以测试连接性。我想知道在失败之前它会尝试多少次?例如,如果你在 CMD 中 ping,它会尝试 4 次。另外,如果它尝试了多次尝试,当一些失败和一些通过时,它如何声明成功或失败?
我似乎在文档中找不到任何内容。
提前致谢!
【问题讨论】:
-
通过阅读这行文档,听起来它只尝试了一次。
This method sends to the host that is specified by address a 32 Byte data buffer with the ICMP echo message. The method waits five seconds for an ICMP echo reply message. If it does not receive a reply in that time, the method returns and the Status property is set to TimedOut. -
显然没有很认真地看文档。
-
这一切都在您必须阅读的文档中。
标签: c# ip-address ping