
$%##%$ Net::FTP timeout DOES NOT WORK for me!
I have followed a recent suggestion about a libnet configuration
setting to get the FTP timeout to work in my FTP script, yet it keeps
locking up during a transfer as you can see at the end of this debug
log...it just sat there for 1/2 hour till I stopped it. I think it
happens when there's a glitch in our DDS line, but the DDS line is
running as good as it's going to get, so I need a robust FTP transfer.
I included the pertinent snippet of code with the FTP commands in it
too.
I hope someone can help me out with this. I've been pulling my hair
out over these lockups during transfers. (it works normally 95% of the
time, but I need as close as possible to 100%).
Thanks much,
Rob
***START DEBUG LOG***
Wed Oct 31 09:45:28 2001 Opening FTP connection.
Net::FTP: Net::FTP(2.56)
Net::FTP: Exporter(5.562)
Net::FTP: Net::Cmd(2.18)
Net::FTP: IO::Socket::INET(1.25)
Net::FTP: IO::Socket(1.26)
Net::FTP: IO::Handle(1.21)
Net::FTP=GLOB(0x4002c0d0)<<< 220 www FTP server (Version wu-2.6.1-16)
ready.
Wed Oct 31 09:45:28 2001 Logging into FTP server.
Net::FTP=GLOB(0x4002c0d0)>>> user heehaw
Net::FTP=GLOB(0x4002c0d0)<<< 331 Password required for admin.
Net::FTP=GLOB(0x4002c0d0)>>> PASS ....
Net::FTP=GLOB(0x4002c0d0)<<< 230 User heehaw logged in.
Sending 27 files.
Net::FTP=GLOB(0x4002c0d0)>>> CWD /home/webpage/billy
Net::FTP=GLOB(0x4002c0d0)<<< 250 CWD command successful.
Wed Oct 31 09:45:29 2001Sending chic_sop_1.html to webserver at
/home/webpage/billy.
Net::FTP=GLOB(0x4002c0d0)>>> PORT 10,10,220,6,18,148
Net::FTP=GLOB(0x4002c0d0)<<< 200 PORT command successful.
Net::FTP=GLOB(0x4002c0d0)>>> STOR chic_sop_1.html
Net::FTP=GLOB(0x4002c0d0)<<< 150 Opening ASCII mode data connection
for chic_sop_1.html.
Net::FTP=GLOB(0x4002c0d0)<<< 226 Transfer complete.
Net::FTP=GLOB(0x4002c0d0)>>> CWD /home/webpage/billy
Net::FTP=GLOB(0x4002c0d0)<<< 250 CWD command successful.
Wed Oct 31 09:45:30 2001Sending index.html to webserver at
/home/webpage/billy.
Net::FTP=GLOB(0x4002c0d0)>>> PORT 10,10,220,6,18,149
Net::FTP=GLOB(0x4002c0d0)<<< 200 PORT command successful.
Net::FTP=GLOB(0x4002c0d0)>>> STOR index.html
Net::FTP=GLOB(0x4002c0d0)<<< 150 Opening ASCII mode data connection
for index.html.
***END DEBUG LOG***
***START CODE SNIPPET***
.
. [includes and other logic snipped]
.
print localtime() . " Opening FTP connection.\n";
my $ftp = Net::FTP->new("$ARGV[0]", Debug => 1, Timeout=>30) || die
"Couldn't get FTP handle.\n";
print localtime() . " Logging into FTP server.\n";
$ftp -> login("$ARGV[1]","$ARGV[2]") || die "Couldn't authenticate on
remote server.\n";
my $status;
print "Sending $#files files.\n";
for ($i = 0; $i <= $#files; $i++)
{
my ($path,$filename);
#SEPARATE THE PATH AND FILENAME FOR FTP.
if ($#filepath != 0)
{
my $i = 0;
for ($i; $i <= $#filepath - 1; $i++)
{
$path = $path . $filepath[$i] . "/";
}
}
$filename = $filepath[$#filepath];
if ($#filepath != 0)
{
chdir "$path";
}
$status = $ftp -> cwd("/home/webpage/$users[$i]") ;
if ($status)
{
print localtime() . "Sending $filename to webserver at
/home/webpage/$users[$i].\n";
my $num_retries = 0;
$status = $ftp -> put("$filename");
if (!$status && $num_retries <= $retries)
{
sleep $delay_between_retries;
$status = $ftp -> put("$filename");
$num_retries++;
}
}
else
{
print "Hey buddy, target path
(/home/webpage/$users[$i]) does not exist!\n";
}
if (!$status) {print "Couldn't transfer file: $filename
successfully.\n";}
Quote:
}
$ftp -> quit;