# ftp timeouts



## kestrelsummer (Jan 10, 2008)

I never have any problem uploading files to my unix web server using WS-FTP interactively from my XP laptop.

However, I am developing a batch file that runs a script to make a common update, and uploads the new files using the command line ftp. Sometimes this version of ftp keeps timing out. I can log in OK, but then any command like ls or put gets a response like this:

200 PORT command successful
421 Idle timeout (120 seconds): closing control connection
Connection closed by remote host.

This seems to be repeatable on any one evening (whilst WS-FTP will still work), but then the next evening it works fine. What's this about?


----------



## tomdkat (May 6, 2006)

Can you post ALL of the output from your batch file?

Peace...


----------



## kestrelsummer (Jan 10, 2008)

OK, so I've had to wait a while for it to fail again. A successful transcript looks like this:

ftp> open hosting5.123-reg.co.uk
Connected to hosting5.123-reg.co.uk
220 ProFTPD 1.3.1rc2 Server (123-reg Web Hosting) [195.224.48.70]
User (hosting5.123-reg.co.uknone)):
331 Password required for jimsimons-1107852

230 User jimsimons-1107852 logged in
ftp> put index.html
200 PORT command successful
150 Opening ASCII mode data connection for index.html
226 Transfer complete
ftp: 5581 bytes sent in 0.00Seconds 558100.00Kbytes/sec
ftp> etc

An unsuccessful one looks exactly the same down to and including

200 PORT command successful

but then, after a two minute pause, it goes on

421 Idle timeout (120 seconds): closing control connection
Connection closed by remote host


----------



## tomdkat (May 6, 2006)

Are you using a response file to automate your FTP file transfers? We do something similar at work. I'll find out what we use and will post more info here in the morning.

Peace...


----------



## Sequal7 (Apr 15, 2001)

Can you send the no operation (noop) or keep alive command?

Maybe your server isnt set up to allow this type of connection?


----------



## tomdkat (May 6, 2006)

tomdkat said:


> Are you using a response file to automate your FTP file transfers? We do something similar at work. I'll find out what we use and will post more info here in the morning.


Ok, we use a tool called RETFTP to run batch file transfers using FTP to some of our systems. I'm not sure if this tool will help you or not.

Peace...


----------



## kestrelsummer (Jan 10, 2008)

Looking at the documentation, RETFTP appears to be something that traps errors in ftp. That's not the problem I have, so I'm not too keen of spending on something that doesn't claim to help. Referring back to sequel7's suggestion, I should have said that when the operation succeeds, it does so within a second or two, so 120 seconds is like infinity, and I can't see keeping the connection alive helping. It does indeed seem that some days the server is set up to allow this operation and some days it isn't, but how can that be? I should have mentioned that the server is supplied by a commercial hosting service; it's not my own server. I have ut the question to the supplier, but haven't yet got through to a human being, and the auto-response is no help.


----------



## tomdkat (May 6, 2006)

Does the timeout occur after a certain number of files have been transferred? Are you using a response file to send the FTP commands?

Peace...


----------



## kestrelsummer (Jan 10, 2008)

The timeout always occurs on the first file I attempt to transfer.

Yes. My batch file contains the line

ftp -s:upload.txt

and upload.txt says this, except that xxxxxxxx is my password:

open hosting5.123-reg.co.uk
jimsimons-1107852
xxxxxxxx
put index.html
put rolling_prices.html
quit


----------

