[ntp:questions] Re: Embedded NTP client

David J Taylor david-taylor at blueyonder.co.not-this-bit.nor-this-part.uk.invalid
Sat Dec 10 08:19:21 UTC 2005


Eugen COCA wrote:
> Yes, the ideea is to display the time from a ntp server on a LED
> display (using the Ethernet connection, in order to verify the server
> is in good working condition). I asked if someone have anything that
> is just ready to use, without doing the whole job from the ground
> (and, of course, if he want to share with us).

You need only build up a packet as described in:

  http://www.faqs.org/rfcs/rfc2030.html

and read the fields in the packet you get back.  For the sort of accuracy 
you appear to want ("wrist-watch" accuracy?), just reading one of the 
server-based time stamps would do.  You might also consider the daytime or 
time protocol:

  http://www.faqs.org/rfcs/rfc867.html

  http://www.faqs.org/rfcs/rfc868.html

Time:
The server listens for a connection on port 37.  When the connection is 
established, the server returns a 32-bit time value and closes the 
connection.  If the server is unable to determine the time at its site, it 
should either refuse the connection or close it without sending anything.

Daytime:
One daytime service is defined as a connection based application on TCP. 
A server listens for TCP connections on TCP port 13.  Once a connection is 
established the current date and time is sent out the connection as a 
ascii character string (and any data received is thrown away).  The 
service closes the connection after sending the quote.

For SNTP, I thought there was source code in the standard distribution.

David 





More information about the questions mailing list