Thread

Posted on Sat Nov 3 00:27:40 2007 by llass61
Can't download file
I'm new to using SSH2 and would like some help. I seem to connect OK with my userID and password, but get a timeout error when I try to get a file.
code:

use Net::SSH2;
use strict;

my $host = "ftp.aaaa.com";
my $ssh2 = undef;
$ssh2 = &connect($host,'USERID','PW');

sub connect
{
my $host = $_[0];
my $user = $_[1];
my $pw = $_[2];
my $file = "aFile.txt";
open(FILE, '>./myFile.txt') or die "Can't create myFile.txt: $!";
print FILE "HELLO";

my $ssh2 = Net::SSH2->new();

$ssh2->connect($host);

if ($ssh2->auth_password($user, $pw))
{
print "\nIN SFTP\n";
$ssh2->scp_get('./test/out/aFile.txt');
print "Error: ", $ssh2->error();
}

$ssh2->disconnect();

return $ssh2;
}

print "HI";

my results are:
IN SFTP
Error: -28LIBSSH2_ERROR_SCP_PROTOCOLTimed out waiting for SCP responseHI

Any help would be greatly appreciated

Larry
Direct Responses: 6436 | Write a response
Posted on Sun Nov 11 11:15:24 2007 by dbrobins in response to 6382
Re: Can't download file
How long does the script appear to wait before the timeout? I take it command-line scp works properly? Does it still fail with Net::SSH2 0.18 (just released)?
Write a response