Page 1 of 1

Does FTPClient support resume after a transfer hangs?

Posted: Friday 2nd April 2021 5:53pm
by Godzilla
Hello,

I use the Gambas FTPClient to transfer ZIP files to a server, and it usually works great.

However, sometimes during an upload, the upload just hangs at a random percentage of the total, and refuses to transfer more. I've added code to ping the receiving server when an upload hangs, hoping it will kick-start the transfer into continuing. Most of the time, however, this doesn't work and the connection must eventually be closed. This leaves a partially uploaded and useless file on the server.

As ZIP files become bigger and bigger (> 2MB), these transfer hangs seem to occur more and more frequently. So its becoming more and more of a problem.

I've considered trying a Linux command-line ftp client LFTP that I could invoke with the Gambas shell, as it supports upload resuming where a transfer left off. But in tests, LFTP opens up a whole new can of worms with unexpected errors I don't get with FTPClient, such as SSL certificate errors and 502 errors, even though the login is successful. I only use straight-up old fashioned FTP protocol. I suppose I'm stuck with using FTPClient.

If FTPClient doesn't support resuming, can someone post sample code on how to handle an FTP upload that hasn't transferred any more bytes in say, 60 seconds? Something like: close the connection, open a new connection, delete the partial file on the server, and transfer the file again in hopes it will complete this time.

Thanks for any tips or code examples.

Godzilla

Re: Does FTPClient support resume after a transfer hangs?

Posted: Friday 2nd April 2021 10:25pm
by BruceSteers
FtpClient supports commands with Exec.

I found this info online..
You cannot modify the partially uploaded or downloaded file created by the adapter, till the file transfer is complete. The FTP or FTPS server must provide support for the REST FTP command to resume the transfer of the file. You cannot resume a file transfer (operation) with the SFTP protocol.
ftp servers support commands REST and STOR for doing this.
been a long time since i did manual net coding so cannot advise on how to use the commands.

Re: Does FTPClient support resume after a transfer hangs?

Posted: Saturday 3rd April 2021 2:56am
by Godzilla
Hey thanks Bruce,

You've given me good info to look into and research. Sounds like a solution to me. I appreciate the help, my friend.

Godzilla