Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: IO::Socket client does not detect when server network connection dies

by sundialsvc4 (Abbot)
on Jul 12, 2011 at 13:21 UTC ( #913916=note: print w/ replies, xml ) Need Help??


in reply to IO::Socket client does not detect when server network connection dies

Logic like this is sometimes well designed using Finite State-Machine (FSM) logic ... for which there are, of course, Perl packages (if you can’t find a package that is even-more well suited to your purposes).   I have found this approach to be very well-suited to ironing out the complexity from otherwise-ornery algorithms that need to “react to” unpredictably changing conditions.


Comment on Re: IO::Socket client does not detect when server network connection dies
Re^2: IO::Socket client does not detect when server network connection dies
by bkchris (Initiate) on Jul 13, 2011 at 14:03 UTC

    Thanks everyone for the feedback. I was to 'heart beat' the connection with IO::Select and can_read(). I'm sure I'll need to tweak it as I dig deeper, but this is a better start.

    my $i = 1; while ( $i > 0 ){ if ($sel->can_read(20)) { my $line = <$socket>; print $line; } else { $socket->send(";"); } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://913916]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2014-11-28 01:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (191 votes), past polls