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

Unruh unruh-spam at physics.ubc.ca
Sun Jul 27 15:23:53 UTC 2008


Set up your own computer running with ntp. YOu can now use that to
experiment with to your heart's content. Filling the net with your
experiments espcially while you do not know what you are doing is not very
polite. 

There is no need to "test the connection". Sending and receiving an ntp
packet "tests the connection" in the only way it needs to be tested and
gives you the time as well. 
On the other hand, do you really want all of the bells and whistles of
SNTP? -- Ie do you really want to be disciplining your local clock? That is
far far better left to a separate program ( ntp or chrony or...)
You have not told us WHY you want to do this. That reason could suggest
much better solutions to us.


Mark <nospam at nospam.com> writes:

>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
>send some data to <time.server.com>
>check for error
>read some data from <time.server.com>
>check for error and check data
>close connection to <time.server.com>

>I also tried:

>open a udp connection to <time.server.com>
>check for error
>send some data to <time.server.com>
>check for error
>close connection to <time.server.com>
>open port 123 for incoming connections
>check for errors
>wait for a connection from the server at port 123
># the remainder never executes
># because the server doesn't reply
>read some data from port 123
>check for error and check data
>close port 123

>There are no errors and no data are received from the server. How do I 
>get the server to respond, so I know that I'm ready to implement the 
>remainder of the protocol?

>Can you recommend any public time servers, or refer me to a list of 
>servers, with reliably connections that are good to experiment with?

>Any help to get me started is highly appreciated (yes, really).

>-- 
>Mark

>Economy-x-Talk
>Have your own custom software created
>http://economy-x-talk.com




More information about the questions mailing list