[ntp:questions] Writing an SNTP script for Runtime Revolution

Richard B. Gilbert rgilbert88 at comcast.net
Sun Jul 27 22:10:57 UTC 2008

Mark wrote:
> Hello,
> I'm new to this list. Thanks for reading this. I hope, with your help, 
> I'll be able to make SNTP available to all Runtime Revolution developers 
> (http://www.runrev.com).
> Obviously, I would like to open a connection to an SNTP server and get 
> the time. I could use a command line tool, but I don't want to use any 
> existing tools for this. I want to read the time from a server, directly 
> from inside Revolution.
> I've had a quick look at 
> <http://www.networksorcery.com/enp/rfc/rfc4330.txt> but I don't know 
> where to start. I believe, I should first try to get some kind of a 
> reply from a server, just to see that I can connect. Once I can do that, 
> I believe want to implement section 5 of the protocol, "SNTP Client 
> Operations".
> In pseudocode, I am doing someting like this:
> open a udp connection to <time.server.com>
> check for error

Since UDP is a connectionless protocol, could you explain how you do that?

> send some data to <time.server.com>
> check for error

Rather than sending random data, don't you think it might work better if 
you sent a properly formatted NTP request packet?

> read some data from <time.server.com>
> check for error and check data
> close connection to <time.server.com>
UDP is a connectionless protocol!

More information about the questions mailing list