Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

socket corruption

8 views
Skip to first unread message

mat...@gmail.com

unread,
Sep 7, 2006, 9:11:03 AM9/7/06
to
I was getting weird errors while experimenting with Pats
dns package using the code below. What it does is
essentially open a tcp socket async to the dns port (53),
gets some stuff, and invokes a callback while its socket is
still open. In the callback I open another socket async but
the writable handler is never invoked if I do dns::cleanup on
the dns token (which closes socket).
It turned out that the second socket created is identical to
the already open one!!!
The debug output looks essentially:

---> cb ::dns::1
...
::dns::1(sock) = sock12
...
socket=sock12

Two different sockets with identical names!!!
This happens consistently on MacOS 10.2.8 Tcl 8.4.9
(sorry for not having a more recent one).
I have tested WinXP using 8.4.12 (I guess) and it happened once,
and then I couldn't reproduce it anymore.

Ideas? Mats

package require dns
proc cb {token} {
global s
puts "---> cb $token"
parray $token
set s [socket -async google.com 80]
fconfigure $s -blocking 0
fileevent $s writable writable
puts "\t socket=$s"
# Try with and without cleanup.
dns::cleanup $token
}
proc writable {args} {
global s
puts "+++> writable s=$s"
close $s
}
dns::resolve google.com -command cb -protocol tcp

0 new messages