in reply to Re^4: Non closing sockets - threads
in thread Non closing sockets - threads
Not a GLOB reference at tcpserver4.pl line 43 (and 83).
Would you try the following changes:
use threads qw[ yield ]; ## Why (*&^^%) isn't that exported by default +? ... threads->create( ... ); yield; sleep 1; ## insert } ...
I just don't see that effect here. No matter how I break the connection--from quitting the client cleanly to killing the client process--the while( <$client> ) loop in the server terminates immediately, and so the thread ends.
This seems to be one of those infamous platform differences. On windows, there are timeouts for inter-character receipt, a per-byte-to-read timeout, and a total read timeout.
Looking at the man page for SetSockOpt(), you could try using SO_RCVTIMEO to set a maximum read timeout and see if that allowed the read to terminate.
Hm. It implies that on your platform, writing to a (dup of) a socket, whilst another thread is in a read state on it, goes ahead immediately.
That doesn't work on here. (At least for sockets as provided by IO::Socket::INET--it seem to work okay from C.)
I've been doing that too. My code (when it works:(), routes the commands using the UnitID input from the command client.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Non closing sockets - threads
by igor1212 (Novice) on Dec 17, 2008 at 08:00 UTC | |
by BrowserUk (Patriarch) on Dec 17, 2008 at 09:48 UTC | |
by igor1212 (Novice) on Dec 17, 2008 at 12:00 UTC | |
by BrowserUk (Patriarch) on Dec 17, 2008 at 13:02 UTC | |
by igor1212 (Novice) on Dec 17, 2008 at 13:34 UTC | |
|