good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Wrapping the socket operations within an eval block will help fix both issues. First, if connection is refused, the error will be put into $@ for later processing if you desire. Second, the timeout effect I believe you're after can be achieved with a local alarm signal handler, and setting the number of seconds before the alarm is raised (this error will also be put into $@ if triggered)...
-stevieb ps. Note that in the IO::Socket::INET documentation, all of the parameters start with an upper-case letter (you mistyped 'Proto' and 'Timeout'). I don't know whether that's operationally important or not in this case, but I wanted to point it out. Not using an API according to the documentation can lead to incorrect results. In reply to Re: test version of ssh from windows
by stevieb
|
|