[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: whence "ping -w"?



On Thu, 2 Nov 2000, Will Day wrote:

> A short time ago, at a computer terminal far, far away, Carel Fellinger wrote:
> >> Can anyone tell me where to find this ping command that offers a "-w"
> >> option (or any other option to set the timeout)?  Or maybe I'm just crazy
> >
> >ping -i <some-number>
> 
> No, that's the delay between multiple packets, not the timeout for each
> packet.

   Yes (ping, most implementations of it I guess) does not have a
'timeout' (if they're at all similar to the one I studied (bing
actually)).
   Note that the following will not really help you at all, it's just
FYI.

   IIRC, most ping implementations send an 8 byte timestamp obtained
with gettimeofday as the payload of their ICMP echo request packets.
This payload is copied in the ICMP echo reply packets. So wwhen ping
receives an ICMP echo reply message that is addressed to itself
(matching icmp id), it just does another call to gettimeofday, substract
the timestamp that was returned, and print the RTT. 
   This way ping does not need to keep track of all the packets it sent
and thus does not need a timeout. It can even handle packets that come
back out of order. 

   I was really confused by ping's code until I realized that. Then I
thought it was pretty cool. 


--
Francois Gouget         fgouget@free.fr        http://fgouget.free.fr/
In theory, theory and practice are the same, but in practice they're different.



Reply to: