[ntp:questions] Getting the version string programmatically ...

Martin Burnicki martin.burnicki at meinberg.de
Thu Dec 17 13:39:41 UTC 2009


David,

David J Taylor wrote:
> The command:
> 
>   ntpq -c rv
> 
> returns a set of data, including the version of NTP in the format:
> 
>   version="ntpd 4.2.6-o"
> 
> I would like to retrieve the same information (just the version field)
> using a UDP interchange with the server rather than running the ntpq
> command.  Could anyone advise what the packet I send to the server should
> contain, and what I might get back?  Perhaps if you could point me to the
> right Web page, please?

some time ago one of my colleagues has picked up the source code of ntpq and
applied some modifications and extensions so that he could build a DLL
which provides the functionality of ntpq via some API calls exported by
that DLL. 

Unfortunatly that colleague is currently out of the office (I think he'll be
back at latest next Monday), but AFAIR that DLL is shipped with the NTP
Time Server Monitor for Windows:
http://www.meinberg.de/english/sw/time-server-monitor.htm#download

If I remember correctly you should have that program running on one or more
of your machines, so you may see if there's a ntpsvcio.dll on those
machines.

Also, if I remember correctly, you are programming in Delphi, so we need to
see if we can define function prototypes in Pascal which lets you Delphi
applications call those DLL API functions. I'm not too familiar with that
DLL, so I'd like to wait until my colleague is back until we can make some
information available how to use that DLL.

Unfortunately those DLL functions are currently not thread-safe, simply
because the source code of ntpq uses some state information in global
variables, which is absolutely OK for ntpq as a standalone application.

Another colleague has recently started to upgrade the source code of the DLL
to use the recent source code of ntpq. Once this has been done we are
planning to see if can make the DLL threadsafe by collecting all those
global variables in a structure, so one instance of that structure can be
used per thread to keep information of the state of a NTP connection.

Martin
-- 
Martin Burnicki

Meinberg Funkuhren
Bad Pyrmont
Germany




More information about the questions mailing list