Re: Windows "C" vs TCL sockets
From: David Gravereaux (davygrvy_at_pobox.com)
Date: 11/25/03
- Next message: Donal K. Fellows: "Re: TIP #166: Reading and Writing the Photo Image Alpha Channel"
- Previous message: Paul Battersby: "Re: Windows "C" vs TCL sockets"
- In reply to: Paul Battersby: "Re: Windows "C" vs TCL sockets"
- Next in thread: marc Thirion: "Re: Windows "C" vs TCL sockets"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 24 Nov 2003 15:04:07 -0800
"Paul Battersby" <batman42ca@yahoo.ca> wrote:
>"David Gravereaux" <davygrvy@pobox.com> wrote in message
>news:fcu4svcco864f1m4pv6aqm3mlfa3jtot78@4ax.com...
>> "Paul Battersby" <batman42ca@yahoo.ca> wrote:
>>
>> >Anything else I should know?
>>
>> socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
>
>> David Gravereaux <davygrvy@pobox.com>
>> [species: human; planet: earth,milkyway(western spiral arm),alpha sector]
>
>Ok, I tried that too. Still doesn't fix it. All I can add is that according
>to the error being returned by the windows code, the "The attempt to connect
>was forcefully rejected."
>
>The socket command returns successfully, it is the connect() call that is
>failing.
Sounds like your server isn't on an interface that's routable to the
client. Even though both are on localhost, do you have a route entry for
localhost? It should be there unless it was removed explicitly.
Did you bind() before connect()? bind() probably isn't needed. A server
placed on localhost probably isn't viewable if you try to connect to [info
hostname], but should work in the other direction. Depending on the route
table order, I've seen some windows machines place listening sockets on the
loopback rather than the first interface.
This is what I get:
C:\WINNT\system32>tclsh84
% proc foo {a b c} {}
% set s [socket -server foo 1234]
sock644
% info hostname
haleakala
%
C:\WINNT\system32>netstat -a | findstr "1234"
TCP haleakala:1234 haleakala:0 LISTENING
C:\WINNT\system32>netstat -a -n | findstr "1234"
TCP 0.0.0.0:1234 0.0.0.0:0 LISTENING
For me, server sockets normally are exposed. Given that Tcl's socket
command can take a bind address for both server and client, you have the
commands to fix the misunderstanding.
C:\WINNT\system32>tclsh84
% proc foo {a b c} {}
% set s [socket -server foo -myaddr localhost 1234]
sock644
%
C:\WINNT\system32>netstat -a -n | findstr "1234"
TCP 127.0.0.1:1234 0.0.0.0:0 LISTENING
-- David Gravereaux <davygrvy@pobox.com> [species: human; planet: earth,milkyway(western spiral arm),alpha sector]
- Next message: Donal K. Fellows: "Re: TIP #166: Reading and Writing the Photo Image Alpha Channel"
- Previous message: Paul Battersby: "Re: Windows "C" vs TCL sockets"
- In reply to: Paul Battersby: "Re: Windows "C" vs TCL sockets"
- Next in thread: marc Thirion: "Re: Windows "C" vs TCL sockets"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|