Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Net::SSH::Perl ConnectTimeout (ssh -o option)

by neilwatson (Curate)
on Aug 10, 2006 at 13:49 UTC ( #566623=note: print w/ replies, xml ) Need Help??

in reply to Net::SSH::Perl ConnectTimeout (ssh -o option)

Looking at the source code, the ToDo file, reveals that this is not yet finished:

$Id: ToDo,v 1.22 2003/12/03 15:35:21 autarch Exp $ Add more tests to the test suite; add SSH2 tests. Fixes to SSH2 implementation: * get rid of dummy shell channel (if possible) * more documentation * anything currently marked XXX in the code Compatibility with NetScreen? Switch over to using Crypt::RSA for SSH1 RSA implementation? SSH2 RSA keys now use Crypt::RSA; at this point it might just be too much extra baggage to try to force people to use Crypt::RSA, because it has so many prereqs. Switch completely to Math::Pari? Worthwhile? Again, don't want existing SSH1 users to have to switch. Use non-blocking connect, like IO::Socket, to implement a connect Timeout. A proper scp client. Port forwarding.

Neil Watson

Comment on Re: Net::SSH::Perl ConnectTimeout (ssh -o option)
Download Code
Re^2: Net::SSH::Perl ConnectTimeout (ssh -o option)
by codejerk (Initiate) on Aug 10, 2006 at 14:26 UTC
    very true. Because this module is unfinished, has anyone managed to use a workaround or modification to (at least temporarily... I'm sure btrott will get back to this module soon) implement a connect timeout?
    to summarize:
    • Net::SSH::Perl is unfinished.
    • Net::SSH::Perl does not yet have an implementation of the SSH ConnectTimeout option.
    • I am searching for a quick, temporary solution to this "feature hole"

    If anyone can assist, I will greatly appreciate the input :)
      This is a very late reply, but this has still not been implemented. I added the following to, right after the socket creation to give me a send/receive timeout of 10 seconds:

      setsockopt($sock, SOL_SOCKET, SO_SNDTIMEO, pack('LL', 10, 0) ) or die $!;
      setsockopt($sock, SOL_SOCKET, SO_RCVTIMEO, pack('LL', 10, 0) ) or die $!;

      Hope that helps.
        This work-around almost solved my problem -- but my time_t was a 64-bit integer. I believe that pack("L!L!",...) is more portable in this case.
        Well this workaround is for timeout while creating SSH object or the timeout is applicable while executing a SSH command using that object. Will it die if there is no response from the command.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (12)
As of 2014-12-18 12:58 GMT
Find Nodes?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?

    Results (51 votes), past polls