|
|
On May 30, 10:36 am, Stuart <bigdak...@xxxxxxx> wrote:
> Perhaps somebody can help me understand this behavior..
>
> On host1 inside the tcl shell I type
>
> set s [socket -async host1 19000]
>
> I get an error "couldn't open socket: connection refused". This I
> expected
> as I have no server listening on host1:19000
>
> On host2 inside the tcl shell I type
>
> set s [socket -async host1 19000]
>
> and I get "sock5". There is still no server listening on host1:19000,
> and so I'm
> wondering why on host2 I don't get the "couldn't open socket:
> connection refused" message?
The reason is that the [socket -async] may fail synchronously on the
local interface (pointing to the same machine), probably due to the OS
optimizing the TCP handshake on the loopback. While when you're
attempting the connection from host2, no such optimization takes
place, and the connect() syscall returns success before getting the
(failed) result from the handshake a finite amount of time later.
-Alex
|
|