Does FTPClient support resume after a transfer hangs?
Posted: Friday 2nd 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
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