prompt has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I am struggling with an FTP transfer which doesnt seem to respect the timeout value, tried both Passive 1 and Passive 0 modes

This is timing out even when i have specified 1200 s timeout. Thanks for your help.

use Net::FTP; my ($dropzone,$path,$l,$p,$filename)=@_; $ftpobj = Net::FTP -> new ($dropzone, Timeout => 1200, Debug => 1,Pas +sive => 0)or die "Cannot connect to $dropzone: $!"; $ftpobj -> login($l,$p)or die "Cannot login to ftp ", $ftpobj->messag +e; $ftpobj -> cwd ($path) or die "$!: No Such path $path"; $ftpobj ->binary; $ftpobj -> put ("$filename") or die "copy failed for $filename...$!\n +", $ftpobj->message; ..........
Command prompt log:
Net::FTP>>> Net::FTP(2.77) Net::FTP>>> Exporter(5.63) Net::FTP>>> Net::Cmd(2.29) Net::FTP>>> IO::Socket::INET(1.31) Net::FTP>>> IO::Socket(1.31) Net::FTP>>> IO::Handle(1.28) Net::FTP=GLOB(0x1db55b4)<<< 220 Microsoft FTP Service Net::FTP=GLOB(0x1db55b4)>>> USER Abc Net::FTP=GLOB(0x1db55b4)<<< 331 Password required for Abc. Net::FTP=GLOB(0x1db55b4)>>> PASS .... Net::FTP=GLOB(0x1db55b4)<<< 230 User Abc logged in. Net::FTP=GLOB(0x1db55b4)>>> CWD /directory1/directory3/Assets/director +y4 Net::FTP=GLOB(0x1db55b4)<<< 250 CWD command successful. Net::FTP=GLOB(0x1db55b4)>>> TYPE I Net::FTP=GLOB(0x1db55b4)<<< 200 Type set to I. Net::FTP=GLOB(0x1db55b4)>>> ALLO 296490288 Net::FTP=GLOB(0x1db55b4)<<< 200 ALLO command successful. Net::FTP=GLOB(0x1db55b4)>>> PORT 10,w,x,y,z,0 Net::FTP=GLOB(0x1db55b4)<<< 200 PORT command successful. Net::FTP=GLOB(0x1db55b4)>>> STOR 1-1112-1356-01_Test_Data_1-1112-1356T +X_V_800.tmp Net::FTP=GLOB(0x1db55b4)<<< 150 Opening BINARY mode data connection fo +r 1-1112-1356-01_Test_Data_1-1112-1356TX_V_800.tmp. Net::FTP=GLOB(0x1db55b4)>>> &#8215;ABOR Net::FTP=GLOB(0x1db55b4)<<< 426 Connection closed; transfer aborted. Net::FTP=GLOB(0x1db55b4)<<< 421 Timeout (120 seconds): closing control + connection. copy failed for Package/1-1112-1356-01_Test_Data_1-1112-1356TX_V_800.t +mp... Connection closed; transfer aborted. Timeout (120 seconds): closing control connection.

Replies are listed 'Best First'.
Re: FTP transfer ABOR
by sierpinski (Chaplain) on Jul 14, 2010 at 17:34 UTC
    What kind of server are you connecting to? I read somewhere that Apache has a default ftp timeout of 300 seconds, so perhaps it has nothing to do with your configuration, but rather the server you are connecting to. Do you have access to the server to see what the settings are?
      Thank you for your reply sierpinski.

      I am able to transfer the same file manually using FileZila which too takes more than 120s. Alas I cannot access the Server any other way than through the ftp account. Is there some way to resume or send the file in parts? is the alarm way suitable for this(http://www.perlmonks.org/index.pl?node_id=317408), renew the connection before 120s is up? shooting in the dark here.

Re: FTP transfer ABOR
by zow (Sexton) on Jul 15, 2010 at 01:06 UTC
    The ABOR command is being sent by the client before the 426 response from the server. Which does suggest that it is comming from the client side. Are you using you're Filezilla client from the same machine that your script is running from? Could be a rule on a router or firewall somewhere impacting the script that does not impact your desktop...
      Thanks for your help. I couldn't figure out what the problem was with timeout, instead used restart() from FTP::Net to append to the file if the file size isn't correct.