[ntp:questions] easy query?

Chuck Swiger cswiger at mac.com
Tue Jun 5 19:23:05 UTC 2012


On Jun 5, 2012, at 11:33 AM, bob wrote:
> Can someone tell me if the code over here is correct:
> http://www.p-jansson.com/2010/03/ntp-client-using-boostasio.html
> He is basically sending this as a query for a timestamp:
> boost::uint8_t data[48] = {
>            0x1B,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
>            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
>         };
> Is that legitimate?

0x1B means sending an (S)NTPv3 client packet [1]; but the code doesn't
seem to be populating the Origin Timestamp.  That's probably adequate
for SNTP anyway, although it really should check whether it got all-zeros
in the Transmit Timestamp or Stratum fields back from the server (ie,
as in a KoD response which just returns the timestamp the client provided).

See: http://tools.ietf.org/html/rfc1769 &  http://tools.ietf.org/html/rfc4330


[1] If my hex to binary bits conversion is right, anyway...  :-)

More information about the questions mailing list