怎么为ping命令设置超时时间

2025-06-26 11:16:36
推荐回答(2个)
回答1:

w后面单位为秒。

        -w deadline

Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received. In this case ping does not stop after count  packet

are sent, it waits either for deadline expire or until count probes are answered or for some error notification from network.

         -W timeout

Time to wait for a response, in seconds. The option affects only timeout in absence of any responses, otherwise ping waits for two RTTs.

回答2:

Ping的格式是这样使用的ping+空+网络地址+空+—t。