Re: socket question



Stuart <bigdakine@xxxxxxx> writes:

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?

With -async you should attach a writable event handler and then check
the socket status when that is called. If a socket fails to open then
it becomes writable and you can check the -error channel configuration
to see how it went.

Are these systems different operating systems? I'm somewhat surprised
you got an immediate failure on one system. I would have expected to
get a socket both times and an error set on the socket channel in the
fileevent.

The wiki has some examples of [fileevent $sock writable]

--
Pat Thoyts http://www.patthoyts.tk/
To reply, rot13 the return address or read the X-Address header.
PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
.



Relevant Pages

  • Re: Interprocess communication on multi-user machine
    ... |>>Normally any user could connect to an open socket on a machine ... On *nix systems, a socket is a file, and is subject to ... They may also be accessed by port numbers, ... do NOT use the usual file ownership and protection mechanisms to ...
    (comp.lang.python)
  • Re: tclProcedure: Is Server Alive?
    ... that my local host has an ip. ... couldn't open socket: host is unreachable ...
    (comp.lang.tcl)
  • Attaching an NKE to Existing Sockets
    ... I would like to be able to attach a socket filter to sockets ... after digging through various structs, I wasn't convinced that I'd be ... I also saw that every open socket is added to the associated proc ...
    (comp.sys.mac.programmer.help)
  • How to kill a CLOSE_WAIT state socket?
    ... My web server services OWS 3.0. ... Using netstat -a, I can see that the open socket is in CLOSE_WAIT state, ...
    (comp.unix.tru64)
  • Re: Socket Infinitely Readable, Not EOF
    ... More (probably useless) information: I tried using the fact that the ... fileevent / readable proc fired and the length of data read from the ... socket is 0 to close the socket, ... Subsequent reconnects fail in the same manner perhaps half a dozen times ...
    (comp.lang.tcl)