APM: Net::FTP recieves file but still reaches timeout without saving

Jeremy Brooks jbrooks4 at austin.rr.com
Tue Aug 31 14:02:20 CDT 2004


good afternoon,

I've written a simple test script (see inline) that connects,
authenticates and gets a file from a Microsoft IIS 5.0 ftp server.
In about 19 out of twenty executions the script timesout before actually
getting the file.  However, without fail, I see the <file size> number
of bytes received over the passive mode data connection.
The file's size is 5169 bytes.

----------------Netstat -an --inet--------------------
tcp  0    25 65.16.122.206:33723  207.200.10.26:21        ESTABLISHED
tcp  5170  0 65.16.122.206:33724  207.200.10.26:1577      CLOSE_WAIT
------------------------------------------------------


I've traced the time out to Net::Cmd.pm line 269 where we use select to
block on the handle used to read data from the server.  

I've enabled passive connections in Net::FTP using FTP_PASSIVE, pasv(),
and Passive=>1.  All  these methods seem to work in that the passive
data connection is established back the server but it's as if Net::FTP
just doesn't do anything with it after the server sends the file.
I've also tried rasing the timeout to 6 minutes which changed nothing
but how long it took me to trouble shoot.  When things work, the
transfer takes on a couple of seconds so I set Timeout=>10.

ncftp works 100% of the time from the same client machine to the same
server.  

Have you any ideas on what's happening here and why it works
occasionally?


the script:
-----------------------------------------------
#!/usr/bin/perl

use Net::FTP;

$ftp =  Net::FTP->new("data.teledynamics.com",Hash=>\*STDOUT,
                      Debug=>1,Passive=>1,Timeout=>10)
        or die "could not make handle\n";

$ftp->login("user","pass") or die "could not login\n";
$ftp->binary();

### Here's where we hang
$ftp->get("/images/ZES120.jpg") or die "could not get file\n";


$ftp->quit;

print "OK ", $ftp->message,"\n";
---------------------------------------------------------------


thanks in advance!

Jeremy Brooks








More information about the Austin mailing list