Tcl_CreateChannelHandler mask value on windows & Solaris

Posted by muralimv on 2010-12-27 22:31

I have used Tcl_CreateChannelHandler to listen to the TCP socket handling.
Here the mask value returned is always 2 even after the TCP connection is closed by the other end on the solaris machine. But on a windows machine the mask value returned is 6 when the connection is closed. While creating the channel the option used is TCL_READABLE . Any idea how to know that the channel is closed without trying to read the channel on Solaris ?

andreas.kupries
ActiveState Staff
Tue, 2011-01-11 15:55

The function Tcl_Eof() returns TRUE for a closed channel.
See http://docs.activestate.com/activetcl/8.5/tcl/TclLib/OpenFileChnl.htm#M25

andreas.kupries
ActiveState Staff
Tue, 2011-01-11 15:57

There is also a blog post about "Concurrency in Tcl". While the example of event handling shown there is a Tcl script, equivalent C code is trivial to make.

andreas.kupries
ActiveState Staff
Tue, 2011-01-11 15:58

See
blog/2010/05/concurrency-tcl-events-without-getting-twisted
on
http://www.activestate.com

andreas.kupries
ActiveState Staff
Tue, 2011-01-11 15:59

My apologies for splitting the url and my answers in this way. It was the only way to get around th spam filter on this forum.