Writing an SNTP script for Runtime Revolution - NTP

This is a discussion on Writing an SNTP script for Runtime Revolution - NTP ; 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 ...

Writing an SNTP script for Runtime Revolution

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

I also tried:

open a udp connection to
check for error
send some data to
check for error
close connection to
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?

Re: Writing an SNTP script for Runtime Revolution

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

SNTP is NOT supposed to serve time unless the system has a hardware
reference clock!!

Normally you would use the full NTP implementation for a server.

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

See the lists of stratum 1 and stratum 2 public servers at http://ntp.org

Re: Writing an SNTP script for Runtime Revolution

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 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
> 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
>check for error
>send some data to
>check for error
>read some data from
>check for error and check data
>close connection to
>I also tried:
>open a udp connection to
>check for error
>send some data to
>check for error
>close connection to
>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

Re: Writing an SNTP script for Runtime Revolution

Mark wrote:> Hello,
>
> I'm new to this list. Thanks for reading this. I hope, with your help,

Actually its a newsgroup.
> 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

UDP is connectionless, so you cannot open a connection.
> 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".

Unless you act as a valid client, you may well not get any reply.
>
> In pseudocode, I am doing someting like this:
>
> open a udp connection to

Physically impossible.
> check for error
> send some data to

Data needs to be a valid SNTP request.
> check for error
> read some data from
> check for error and check data
> close connection to
>
> I also tried:
>
> open a udp connection to
> check for error
> send some data to
> check for error
> close connection to
> open port 123 for incoming connections

The response will be to the source port you used in the request.
Note previous comment about there being no connections.
>
>
> Can you recommend any public time servers, or refer me to a list of
> servers, with reliably connections that are good to experiment with?

Install ntpd on a local machine.
>

Re: Writing an SNTP script for Runtime Revolution

On 2008-07-27, Richard B. Gilbert wrote:
> See the lists of stratum 1 and stratum 2 public servers at http://ntp.org

Re: Writing an SNTP script for Runtime Revolution

Steve Kostecke wrote:
> On 2008-07-27, David Woolley wrote:
>> Richard B. Gilbert wrote:
>>> David Woolley wrote:
>>>> Mark wrote:> Hello,
>>>>> I'm new to this list. Thanks for reading this. I hope, with your help,
>>>> Actually its a newsgroup.
>>> It's also a mailing list!
>> It is gatewayed to a mailing list.
>
> What, exactly, does this have to do with the OP's question?
>

He had a question? It seems to have been trimmed somewhere along the way!

Re: Writing an SNTP script for Runtime Revolution

Richard B. Gilbert wrote:
>> What, exactly, does this have to do with the OP's question?
>>
>
> He had a question? It seems to have been trimmed somewhere along the way!

The OP would like to write (S)NTP Software in a
"natural language" style programming environment.

Re: Writing an SNTP script for Runtime Revolution

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
> 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
> check for error

Since UDP is a connectionless protocol, could you explain how you do that?
> send some data to
> 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
> check for error and check data
> close connection to
UDP is a connectionless protocol!
>

Re: Writing an SNTP script for Runtime Revolution

In article,
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.
>

Hi people,

Thanks for your replies, even if not too helpful. Especially the
discussion about whether this is a list or not is quite fascinating.

Some of the links you provided are useful. I'll check them out.

Somewhere else, I have found a good perl script, which I'll port to
Revolution.

Re: Writing an SNTP script for Runtime Revolution

Mark writes:
>In article
>,
> 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.
>>
>
>Hi people,
>Thanks for your replies, even if not too helpful. Especially the
>discussion about whether this is a list or not is quite fascinating.
>Some of the links you provided are useful. I'll check them out.
>Somewhere else, I have found a good perl script, which I'll port to
>Revolution.

You still have not told us what you are trying to do, and why.
Sending out an ntp packet to a remote host and receiving back a reply to
determine the time is easy. What do you want to do with that time? If you
want to discipline your computer's clock there a loads of issues that need
to be thought through and have been thought through in say ntpd. If you
just want the remote time for some reason, then it is trivial.

Re: Writing an SNTP script for Runtime Revolution

In article ,
Unruh wrote:
>
>
> You still have not told us what you are trying to do, and why.
> Sending out an ntp packet to a remote host and receiving back a reply to
> determine the time is easy. What do you want to do with that time? If you
> want to discipline your computer's clock there a loads of issues that need
> to be thought through and have been thought through in say ntpd. If you
> just want the remote time for some reason, then it is trivial.

Dear Unruh,

I just needed something to get started with SNTP. Probably, sending a
header and getting any kind of reply is sufficient. I have found
something and now I'll see how far I can stretch it. Thanks for your
reply.

Re: Writing an SNTP script for Runtime Revolution

Mark writes:
>In article ,
> Unruh wrote:
>>
>>
>> You still have not told us what you are trying to do, and why.
>> Sending out an ntp packet to a remote host and receiving back a reply to
>> determine the time is easy. What do you want to do with that time? If you
>> want to discipline your computer's clock there a loads of issues that need
>> to be thought through and have been thought through in say ntpd. If you
>> just want the remote time for some reason, then it is trivial.

>Dear Unruh,
>I just needed something to get started with SNTP. Probably, sending a
>header and getting any kind of reply is sufficient. I have found
>something and now I'll see how far I can stretch it. Thanks for your
>reply.

SNTP includes the whole protocol of disciplining the local clock as well as
geting the information from the remote server. I have no idea why you want
a clock discipline routine in Revolution. It does not belong there.
But you might want to get the remote time for some reason.

For something like this you should not be recommending the stratum 1 or
2 servers. There are two many restrictions on stratum 1 and 2 servers
for general use. See the rules of engagement. You should be pointing to
the pool servers at pool.ntp.org or their country specific domains.

you == ?
> should not be recommending the stratum 1 or 2 servers. There are two
> many restrictions on stratum 1 and 2 servers for general use. See the
> rules of engagement. You should be pointing to the pool servers at
> pool.ntp.org or their country specific domains.