Terje Mathisen schrieb:
Writing a really tiny (S)NTP server should be a fun exercise, as long as
you can make the following (extremely) simplifying assumptions:
a) The local system clock is always correct
I start the "simple ntp daemon" as soon as the other timesource is
alive. As soon as this is true the time is almost correct. If it isn't
correct for one or two milliseconds, then this is no problem for me.
b) All time stamps can be assumed to be correct.
Time stamps?
c) No need to support either authentication or any form of ntpq/ntpdc
queries.
I just want to publish the time of the clock on the "embedded linux
box" to everyone who is able to connect to the box on the
LAN-Interface where the "simple ntp daemon" is listening. I don't want
anything more. People aren't allowed to do anything on that box. They
are only allowed to sync their time.
Under these assumptions you can reduce the code to something like this:
I also tried to start searching the basic information for writing
something on my own, but I couldn't find any good documentation of the
NTP-protocol (the RFC seems to be to difficult for me, especially as
I'm german...). I tried to just "telnet" to the port 123 of any
NTP-server to be at least able to see how the response looks like, but
I didn't receive any response using telnet. Telnet just told me that
it isn't able to connect.
I.e. it should be possible to reduce the code to less than 1 KB as long
as the socket library code is already resident.
I never developed network applications so far for unix, but if I find
out how this NTP-protocol works I'm sure I'll find tutorials about
unix socket programming using any search engine.
CU
Manuel
_______________________________________________
questions mailing list
[email protected]
https://lists.ntp.isc.org/mailman/listinfo/questions