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?