|
||||||||
|
|
#1
|
|
I only want to send one packet to another host to check whether it is
connected or not. I want to have 2 seconds timeout. I use, ping -c 1 -w 2 192.168.0.2 If host is not connected, it fails correctly. BUT summary says. PING 192.168.0.2 from 192.168.0.1 : 56(84) bytes of data --------192.168.0.2 ping statastics -------- 2 packets transmitted, 0 received, 100% loss, time 999ms Why 2 packets are sent instead of 1 (specified) and why it only waits for 999 ms instead of 2 seconds. Even if I use: ping -c 5 -w 2 192.168.0.2, it has the same result. Here I wanted to send 5 packets but, again 2 packets were sent? What is wrong here? Please help me. Thanks a lot Neel |
|
#2
|
|||
|
|||
|
Neel <(E-Mail Removed)> wrote:
> I only want to send one packet to another host to check whether it is > connected or not. I want to have 2 seconds timeout. > I use, ping -c 1 -w 2 192.168.0.2 > If host is not connected, it fails correctly. BUT summary says. > PING 192.168.0.2 from 192.168.0.1 : 56(84) bytes of data > --------192.168.0.2 ping statastics -------- > 2 packets transmitted, 0 received, 100% loss, time 999ms > Why 2 packets are sent instead of 1 (specified) and why it only waits > for 999 ms instead of 2 seconds. The two vs one may simply be an OBO bug (off by one) - send one right away, send one after the first timeout. (Double check that the manpage for your ping's -c option matches your expectation of course The999ms could be that the ping command got some other indication that the response wasn't going to arrive - sometimes I've seen messages elsewhere that imply that ARP sent something up the stack that said it couldn't map the IP to a MAC - perhaps that makes it all the way to ping which then "knows" that waiting for the full timeout is pointless. Might be worthwhile doing a system call trace of the ping command. > Even if I use: ping -c 5 -w 2 192.168.0.2, it has the same result. Here > I wanted to send 5 packets but, again 2 packets were sent? Might check the ARP tables and the ARP timeouts. If the system is not up, and is "local" then the gating factor might be ARP not ping. rick jones -- oxymoron n, commuter in a gas-guzzling luxury SUV with an American flag these opinions are mine, all mine; HP might not want them anyway... ![]() feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH... |
![]() |
| Tags |
| ping, properly, work |
| Thread Tools | |
| Display Modes | |
|
|