[ntp:questions] Initialize NTP request

Danny Mayer mayer at ntp.isc.org
Mon Jul 30 13:30:11 UTC 2007


Dreamchaser wrote:
> I'm sorry if this not the correct newsgroup, but I'm not sure which one 
> it would be.
> 
> I am working on an implementation of NTP for an application that I am 
> writing. I can't figure out how to get a response from a NTP server on 
> the Internet (time-a.nist.gov). I have read through the RFC on the NTP 
> protocol and still can't figure it out. The RFC says to send a request 
> to the server to get a response...Ok...What is the request? With a TCP 
> connection just the fact of opening the connection is the request But 
> with UDP I realize that I have to send something to get a response.
> 

You create a UDP socket, send a mode 3 (client) packet to the server
which will reply with a mode 4 (server) packet. See Section 3 of the
latest NTPv4 IETF draft:
http://www.ietf.org/internet-drafts/draft-ietf-ntp-ntpv4-proto-07.txt

which describes the basic functionality. You may want to look at the
SNTP client in the reference implementation available via
http://support.ntp.org/ .

Danny



More information about the questions mailing list