Net :: SSH2의 scp_put 메서드를 사용하여 Windows 상자에서 유닉스 서버의 홈 디렉토리에 하나의 파일을 저장합니다. Strawberry Perl 5.12 (휴대용 버전)를 사용하고 있습니다. libssh2 1.2.5 바이너리를 설치 한 다음 cpan에서 Net :: SSH2를 설치했습니다.Perl Net :: SSH2 scp_put이 파일을 put 한 후 멈춤
sub uploadToHost{
my [email protected]_[0];
my [email protected]_[1];
my [email protected]_[2];
my [email protected]_[3];
my [email protected]_[4];
#makes a new SSH2 object
my $ssh=Net::SSH2->new() or die "couldn't make SSH object\n";
#prints proper error messages
$ssh->debug(1);
#nothing works unless I explicitly set blocking on
$ssh->blocking(1);
print "made SSH object\n";
#connect to host; this always works
$ssh->connect($host) or die "couldn't connect to host\n";
print "connected to host\n";
#authenticates with password
$ssh->auth_password($user, $pass) or die "couldn't authenticate $user\n";
print "authenticated $user\n";
#this is the tricky bit that hangs
$ssh->scp_put($file, $remotelocation") or die "couldn't put file in $remotelocation\n";
print "uploaded $file successfully\n";
$ssh->disconnect or die "couldn't disconnect\n";
} #ends sub
출력 (익명 위해 편집) :
만든 SSH 개체 \ n
연결 \ 호스트 N
인증 \ n을
여기 내 코드입니다
libssh2_scp_send_ex (ss-> 세션, 경로, 모드, 크기, mtime, atime) -> 0x377e61c \ 없음
순 :: SSH2 :: 채널 :: 읽기 (크기 = 1, 내선 = 0) \ n 그런 다음 영원히 중단
(> 하나 개의 테스트에서 40 분)과은에 필요 살해 당한다.
무엇이 이상한가요? 은 실제로 원격 서버에 파일을 scp합니다! 완료된 후에 만 중단됩니다. StackOverflow 또는 다른 곳에서이 호기심 문제에 대한 참조를 찾을 수 없습니다.
누구나 나를 올바른 방향으로 가리킬 수 있습니다 1) 교수형에서 중지하거나 2) (이 해결 방법으로 몇 초 후에이 한 명령을 죽이는 타이머를 구현하는 파일을 scp하는 충분한 시간입니다 ?
감사합니다.
5MB/s를 수행 할 수있는 링크에서 약 150kB/s 속도로 시작하지만 약 2MB의 데이터가 전송 된 후에는 약 5KB/s로 느려집니다. 따라서 실제로는 문자 그대로 1000x 느리게 실행됩니다. – MikeKulls