bucz has asked for the wisdom of the Perl Monks concerning the following question:
Hi
I am making some small server using sockets in non-blocking mode. I want to check if the client (telnet) is still connected, but I don't know how.
Reading routine looks like that (from web):
$rv = sysread($sock2, $buffer, $BUFSIZ); if (!defined($rv) && $! == EAGAIN) { } # HERE else { print $sock1 $buffer; }
I suppose that HERE I should check for some disconnect error, but I am not sure...
Oh Monks, help me with your wisdom!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Checking if a non-blocking socket is active
by ikegami (Patriarch) on Oct 09, 2009 at 18:46 UTC | |
by bucz (Novice) on Oct 11, 2009 at 19:49 UTC | |
by desemondo (Hermit) on Jul 03, 2012 at 12:19 UTC | |
|
Re: Checking if a non-blocking socket is active
by rcaputo (Chaplain) on Oct 09, 2009 at 17:59 UTC |