How to keep ftp connection alive

ftp

Some ftp websites have a small time out value. When you do some other jobs, ftp connection dies and you should log in again.

How can I keep my connection alive?

Edit:
It will be appreciated if somebody provide a method for ftp command as it is light and easy.

Best Answer

There is no absolute answer here, as FTP protocol in itself does not include such a mechanism.

There is however, FTP protocol commands with no real meanings on a given situation like "NOOP", "LIST" or "CWD" which can be used to keep the FTP connection alive.

So this is up to the client itself to implement such a mechanism using these "meaningless" commands in order to reset the timeout timers on the server side. Of course, you might also need to tune these client side mechanism in order to match the server side max idle time value.

To give you an example, the well known Filezilla is implementing such a mechanism (see in "Edit" -> "Settings" menu item, then in "Connection" -> "FTP" tab):

Filezilla Settings

Answer to edit: As said, only evolved ftp client would have such functionality. Default ftp client, Windows and Linux alike, are not able to apply such keep alive behavior.

Related Question