Tk Library Source Code

View Ticket
Login
Ticket UUID: 744391
Title: empty result with FreeBSD tcp 37 time service
Type: Bug Version: None
Submitter: juliannoble Created on: 2003-05-27 17:16:28
Subsystem: ntp Assigned To: patthoyts
Priority: 7 High Severity:
Status: Closed Last Modified: 2003-05-29 07:45:55
Resolution: Fixed Closed By: patthoyts
    Closed on: 2003-05-29 00:45:55
Description:
The line in ::time::QueryTime of time.tcl:
puts -nonewline $State(sock) "abcd"
causes problems with a FreeBSD 4.7 time service. 

Test against ntp.webpub.net to see that $State
(data) is empty. 
Removing that line fixes it - and I see it still works 
without that line for the sample given, 
ntp2a.mcc.ac.uk 
According to rfc868, the server should respond 
with the time upon connection.
Is this line above, a hack to work around some 
particular server implementation that needs to 
receive bit of data before responding?  If so, could 
it be changed to an option such as -prod?
User Comments: patthoyts added on 2003-05-29 07:45:55:
Logged In: YES 
user_id=202636

With some testing it seems that the webpub server only
responds to tcp connections. If you do a 
set tok [time::gettime -protocol udp ntp.webpub.net]
time::status $tok
it returns 'error' and ::time::error $tok tells you it timed
out.
If you set the protocol to tcp then it's happy.

UDP is used if you have tcludp installed. You can opt for
tcp by using the -protocol switch.

patthoyts added on 2003-05-28 18:15:36:
Logged In: YES 
user_id=202636

The line in question is an artifact of the udp support. It
should have been removed. For tcp/37 connections we are not
supposed to send anything but just await an answer. For
udp/37 we have to send an empty packet first. Evidently
FreeBSD's service is a bit on the strict side.

I'll fix this so an empty packet is only sent if UDP is in use.