Re: socket question



On May 30, 1:49 am, Pat Thoyts <cnggub...@xxxxxxxxxxxxxxxxxxxxx>
wrote:
Stuart <bigdak...@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?

Hardly. hostt1 is running Solaris8 and host2 is running Solaris 7.


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]


Thanks for the tip.

Stuart
--
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: 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)
  • Re: Not able to know the device is alive or not after rebooting...
    ... Puneet wrote: ... I mean we fire an event that listen continuosly that socket ... to listen--but fileevent only is useful after ... until you know that the host is up. ...
    (comp.lang.tcl)
  • Re: Socket Infinitely Readable, Not EOF
    ... tcl script opens two socket servers, ... an indicator of "connection reset by peer". ... zero-length fileevent should not occur in normal operation. ...
    (comp.lang.tcl)
  • async tls socket using too much cpu
    ... I'm having a problem using the tls package and asynchronous ... The problem is that too much CPU is consumed. ... The socket is opened using. ... Run step 3 when [fileevent] says the socket is ...
    (comp.lang.tcl)
  • Re: Socket Infinitely Readable, Not EOF
    ... non-blocking on the readable event appears to be the problem. ... I wouldn't say fileevent is strictly an alternate to non-blocking. ... I suppose what I could do is try setting the socket blocking, ... What I'm thinking may be going on here is issues at the TCP level. ...
    (comp.lang.tcl)