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

Differences of behaviour between Windows and Linux (sockets, 8.6b)

171 views
Skip to first unread message

Emmanuel Frecon

unread,
May 25, 2012, 4:32:28 PM5/25/12
to
Dear fellow Tcl:ers,

I am going to give it a go at a question, even though I have at this point difficulties to understand what is happening right now.

I have some code that was working perfectly in 8.5 both on Linux and Windows. The software, among other things implements a web server (it is my old web server from til, revamped and now hosted at Google code http://code.google.com/p/efr-tools/source/browse/#svn%2Ftrunk%2Ftil%2Fminihttpd).

You might have understood from my previous post today that I am slowly moving to IPv6, so I am trying to run the code under 8.6. Basically, what I have problem with is that the code runs perfectly on Linux, but blocks on Windows. I have been able to track it down to the procedure being bound to "accept", i.e. to be run when a client connects, is never called on Windows. Every access to the server timeouts for reasons that I cannot explain. Since the code has moved from versions to versions of Tcl (actually, since 8.2 if I remember it right), it is event based and does not make use of the new stuff from 8.6.

I don't really know where to start. I have tried with all firewalls turned off and on two different Windows (7, 32bits Tcl on 64bits OS) installations. Any ideas?

/Emmanuel

tomás zerolo

unread,
May 26, 2012, 4:13:43 AM5/26/12
to
Emmanuel Frecon <efr...@gmail.com> writes:

> Dear fellow Tcl:ers,
>

[accept works on Linux, seems to hang on Windows]

> I don't really know where to start. I have tried with all firewalls turned off and on two different Windows (7, 32bits Tcl on 64bits OS) installations. Any ideas?

No concrete idea, but (possibly obvious to you, sorry in that case)
general advice:

Have you tried to throw a network monitor (running on the Windows box)
at that (Wireshark is a good choice)? Can you see the SYN coming in? The
SYN ACK going out? Etc.

There must be some sort of system call monitor for Windows (à la
strace). This might help to further narrow the search space.

HTH
-- tomás

Emmanuel Frecon

unread,
May 27, 2012, 7:41:35 AM5/27/12
to
You are right, I will try to have a look with wireshark. I wish I could shrink this to an example that I can share on the group, but it is a whole lot of code... I will keep you all posted. Thanks.

chris....@ymail.com

unread,
Dec 19, 2012, 12:27:11 PM12/19/12
to
Are you using -myaddr in your call to socket?

Check out this page (replace java with Tcl) and this is the problem I was having:
http://stackoverflow.com/questions/3375435/avoid-windows-firewall-popup-with-sockets-on-localhost
Following the advice of the answer, I popped open tkcon (8.6.0.0 beta-7) and found the following results in accept being properly called:

proc accept {c a p} {puts "accept $c $a $p"}
set server_socket [socket -myaddr 127.0.0.1 -server accept 9900]
set client_socket [socket localhost 9900]

and the following does not:

proc accept {c a p} {puts "accept $c $a $p"}
set server_socket [socket -server accept 9900]
set client_socket [socket localhost 9900]

In 8.5, both versions work. Hope this helps. -crs

chris....@ymail.com

unread,
Dec 19, 2012, 1:41:13 PM12/19/12
to
I decided to do more digging and found this to be fixed in 8.6.0.0b8

I use the pre-builts from here:
http://www.activestate.com/activetcl/downloads

I installed the Windows (x86) on both a 32-bit XP box and a 64-bit Windows 7 box
I installed the Windows (64-bit, x64) on the Windows 7 box

The accept proc is called whether or not -myaddr is specified in the socket command - fixed!

Also, time {socket localhost 9900} was indicating that it was taking ~1 SECOND to connect in 8.6.0.0b7. This is back down to the ~1 ms range in 8.6.0.0b8


Aside: Now I need to find or open a bug against tkcon - up arrow no longer cycles through command history in 8.6.0.0b8
0 new messages