为什么我的perl ftp脚本在上传小文件时超时?

问题描述

我不明白为什么我的下面的脚本挂起并在传输非常小的文件时超时。如果有人可以提供帮助,无论是配置问题还是其他问题。

#!/usr/bin/perl
 use strict;
 use warnings;

use Net::FTP;

my $host    = "server";
my $user    = "username";
my $pass    = "password";
#!!!!!!!!!!!!!!!!!!!!!!!!!!


 my $ftp = Net::FTP->new($host,passive => 1,time => 360,Debug => 1) or die "Error connecting to $host: $!\n";
 $ftp->login($user,$pass) or die "Cannot login to $user: $!\n";
 $ftp->ascii();
 #!!!!!!!!!!!!!!!!!!!!!!!!!!

opendir(my $DIR,"./") or die $!;
my @files=readdir($DIR);
foreach my $file (@files){
 next if -d $file;
 next unless $file =~/^OBS_ZB/;
 for my $file(glob 'OBS_ZB*'){
  eval{$ftp->put($file,$file) or print("Can't send file $file\n")};
  if($@ =~ /Timeout/){
   print "Got a timeout Issue: $@";
  }
 }
}
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
print "copying ends\n";
exit 0;

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)