Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Net::Telnet - how to detect a reset connection ?

by vladdrak (Monk)
on Dec 13, 2006 at 08:35 UTC ( [id://589518]=note: print w/replies, xml ) Need Help??


in reply to Net::Telnet - how to detect a reset connection ?

I've run into this same issue and resolved by wrapping calls in an eval block, like below. This only works on *NIX boxes though -- Windows doesn't support signals per se.
my $timeout = 20; my $result = eval { local $SIG{ALRM} = sub { die "timed out\n" }; alarm $timeout; my $result = send_command(); alarm 0; return $result; }; if ($@) { print "command timed out\n"; do_something_else(); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2024-04-18 12:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found