Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-12-14
01:07 • Closed ticket [478565ffff]: fconfigure -sockname performance issue plus 6 ot... artifact: 1244210d07 user: andreas_kupries
2001-12-13
21:55 • Ticket [478565ffff]: 5 changes artifact: e6e358a1c2 user: dkf
2001-12-12
02:20 • Ticket [478565ffff]: 4 changes artifact: 9332995d96 user: andreas_kupries
02:20 • Add attachment 478565.diff to ticket [478565ffff] artifact: 41b8fd04b3 user: andreas_kupries
02:20 • Ticket [478565ffff] fconfigure -sockname performance issue status still Open... artifact: d59933960b user: andreas_kupries
2001-11-26
20:31 • Ticket [478565ffff]: 4 changes artifact: c6d4f9b67c user: dkf
05:19 • Ticket [478565ffff]: 4 changes artifact: f9e748d5e1 user: nobody
2001-11-06
05:25 • New ticket [478565ffff]. artifact: 7e32896b18 user: nobody

fconfigure -sockname performance issue

Closed / Fixed478565ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-11-06 05:25:50
On Windows NT 4.0 SP6a with Tcl 8.3.2, using fconfigure -sockname on a server socket can 
cause 
a 10-20 second delay depending upon the system configuration.

The following code snippet illustrates the behavior:

proc ServerAccept { cid addr port } {
    return
}
set sock [socket -server ServerAccept 0]
puts "socket: $sock"
set data [fconfigure $sock -sockname]
puts "DATA: $data"

fconfigure -sockname triggers a call to gethostbyaddr() on the local IP address, 0.0.0.0 in this 
case.  On NT 4.0 (but not Windows 2000 or UNIX), this leads to a 10-20 second delay while the 
gethostbyaddr() call times out.

Although this is actually an NT issue and not a Tcl one, a simple workaround in the Tcl code would 
be to avoid the gethostbyaddr() call if the IP address is 0.0.0.0 on NT 4.0.  A workaround for the 
end user with the current code is to add a line to c:\winnt\system32\drivers\etc\hosts:

0.0.0.0  0.0.0.0
nobodyplain2001-11-26 05:19:10
Logged In: NO 

This bug exist in Windows 98 and Tcl 8.3.4.  Delay is ~16 
seconds per [fconfigure -sockname sock???].  Adding 0.0.0.0 
0.0.0.0 in hosts.sam not resolve problem.
dkfplain2001-11-26 20:31:34
Logged In: YES 
user_id=79902

It should be pretty trivial to detect '0.0.0.0' for
ourselves and skip the name lookup in that case (it's not an
address that should map to any particular name anyway.)
andreas_kupriesplain2001-12-12 02:20:05
Logged In: YES 
user_id=75003

Enclosed is a tentative patch which compiles and passes the 
testsuite. As my system is Win/2K I cannot check if the 
patch truly solves the problem for Win/NT.

Assigning to Donal now for a quick lookover.
andreas_kupriesplain2001-12-12 02:20:06
File Added - 14522: 478565.diff
dkfplain2001-12-13 21:55:36
Logged In: YES 
user_id=79902

Looks OK to me; "Make It So!"
andreas_kupriesplain2001-12-14 01:07:47
Logged In: YES 
user_id=75003

Committed to head.
Log in (anonymous is fine) to add a comment.

Attachments: