0

I have to send 10 packet & timeout for each packet should be 3 secs. As Android pings works on Linux ping commands, I am using below ping command in my application:

ping -c 10 -W 3 -s 32 www.google.com

It gives the below response which I read in buffer & printed in console with time-stamp (month-date hh:mm:ss:SSS) in prefix:

01-27 16:49:08.733: icmp_seq=1 ttl=45 time=138 ms

01-27 16:49:09.774: icmp_seq=2 ttl=45 time=309 ms

01-27 16:49:10.585: icmp_seq=3 ttl=45 time=116 ms

01-27 16:49:11.566: icmp_seq=4 ttl=45 time=94.3 ms

01-27 16:49:12.567: icmp_seq=5 ttl=45 time=92.5 ms

01-27 16:49:14.569: icmp_seq=7 ttl=45 time=100 ms

01-27 16:49:15.570: icmp_seq=8 ttl=45 time=97.1 ms

01-27 16:49:16.551: icmp_seq=9 ttl=45 time=75.6 ms

01-27 16:49:17.552: icmp_seq=10 ttl=45 time=76.2 ms

01-27 16:49:18.584: --- www.google.com ping statistics ---

01-27 16:49:18.584: 10 packets transmitted, 9 received, 10% packet loss, time 1099ms

As 6th packet missed but I didn't recieved any timeout event/message for it. And timeout was 3 sec (-W 3) but still 7th packet got received before 3sec timeout.

Anyone from experts, could you please let us understand how ping timeout (-W) works in Android/Linux? Should I use another parameter to achieve my requirement?

1
  • I don't see a problem here. The packet didn't come back within 3 seconds. If it had, you would have seen it. Jan 28, 2014 at 5:28

2 Answers 2

0

if I correctly understood you, you should use -w option (not -W). Somebody has explained it here: https://stackoverflow.com/questions/17951182/ping-timeout-command-w-not-working-for-android

0

-w is for deadline of ping command irrespective of num of packet sent/recieve. I have to wait (maximum time) for 3 sec for each packet response. In case of no response in 3 sec, next packet should be send after this.

Reference: Window's ping command behavior as mentioned below

ping -n 4 -w 3000 www.abcd.com

Pinging www.google.com [173.194.38.178] with 32 bytes of data:

Reply from 173.194.38.178: bytes=32 time=61ms TTL=53

Request timed out.

Reply from 173.194.38.178: bytes=32 time=68ms TTL=53

Reply from 173.194.38.178: bytes=32 time=61ms TTL=53

Reply from 173.194.38.178: bytes=32 time=66ms TTL=53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .