Subject: | Net::SSH2::connect |
Date: | Fri, 13 Dec 2013 14:55:36 +0000 |
To: | "bug-Net-SSH2 [...] rt.cpan.org" <bug-Net-SSH2 [...] rt.cpan.org> |
From: | "Joshi, Jayesh" <jjoshi [...] idirect.net> |
Hi,
I would expect the connection to timeout should be 30 seconds in the following test script.
However the timeout is reported after approx. 3.01 seconds. (BTW - I tried increasing the timeout to 3000, but I see similar results.)
FYI : I have the following:
[JKJ Dev] # perl -MNet::SSH2\ 9999
Net::SSH2 version 9999 required--this is only version 0.53.
The test script:
#!/usr/local/bin/perl
use strict;
use warnings;
use Time::HiRes qw(gettimeofday tv_interval);
use Data::Dumper;
use Net::SSH2;
my $host = "10.1.244.66"; # unreachable IP
my $port = "9675";
my $timeout = 30;
my $ssh2 = Net::SSH2->new();
print "Making Connection\n";
my $t0 = [gettimeofday()];
eval {
$ssh2->connect($host, $port, Timeout=>$timeout);
# $ssh2->connect($host, $port);
};
my $lapsed_time = tv_interval ( $t0, [gettimeofday()]);
if ($@) {
print ("Lapsed Time = $lapsed_time, Connection failed to Host: $host on Port: $port , with Timeout: $timeout seconds.\n");
} else {
print "Fat Lady is singing!\n";
}
1;
Is there a bug with the "Timeout" in Net::SSH2::connect method?
Regards,
Jayesh
Show quoted text
________________________________
Jayesh Joshi Senior Software Engineer, SatManage * p: +44 1234.759.615 * m: +447951 783 920
Please note our new business address:
iDirect, 1st Floor Derwent House, University Way, Cranfield, Beds, MK43 0AZ, UK * www.idirect.net<http://www.idirect.net/> * Advancing a Connected World
Connect with iDirect: Twitter.com/iDirect<http://twitter.com/idirect> * Facebook.com/iDirect<http://www.facebook.com/idirect>