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 ( #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? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2023-02-06 06:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (33 votes). Check out past polls.

    Notices?