Does FTPClient support resume after a transfer hangs?

Post your Gambas programming questions here.
Post Reply
User avatar
Godzilla
Posts: 61
Joined: Wednesday 26th September 2018 11:20am

Does FTPClient support resume after a transfer hangs?

Post by Godzilla » Friday 02nd April 2021 5:53pm

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

User avatar
BruceSteers
Posts: 443
Joined: Thursday 23rd July 2020 5:20pm

Re: Does FTPClient support resume after a transfer hangs?

Post by BruceSteers » Friday 02nd April 2021 10:25pm

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.
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
Godzilla
Posts: 61
Joined: Wednesday 26th September 2018 11:20am

Re: Does FTPClient support resume after a transfer hangs?

Post by Godzilla » Saturday 03rd April 2021 2:56am

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

Post Reply