[ntp:questions] Any samples for NTP/SNTP client code?

Jan Ceuleers janspam.ceuleers at skynet.be
Mon Dec 3 19:18:34 UTC 2007


guuwwe at hotmail.com wrote:
>  Just look at the NTP/SNTP request format and for ***every*** field
>  explain why would a client send it to a server. Do not pick just one
>  field like MODE, explain for ***all*** fields.

I believe that the principal reason for having the same format for the 
received and the transmitted packet is so that the server can reply 
simply by modifying the received packet and transmitting the result.

This means that there is no need to allocate memory for constructing the 
reply packet, no need to copy data from received to transmitted packet, etc.

This could conceivably be done very close to (or indeed in) the 
hardware, but even if it is done in user space (as is the case in ntpd) 
this saves precious time, which is important in a timing application.

Optimising the packet format for conveying just enough information (i.e. 
optimising for bandwidth) is of secondary importance (particularly given 
the overhead that IP already represents), and is in fact 
counterproductive in the light of the above argument.

Hope this helps.

Cheers, Jan




More information about the questions mailing list