0 votes

I have come across a problem uploading some files to our FTP server.
I am uploading all the files in a particular folder, and when it reaches a file over 1Gb in size it stops with the following error:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

If I remove this file, all other files are uploaded. I seems like a problem with the FTP server, but something curious: if I use Windows Explorer to connect and upload the file manually, this file DOES transfer without interruption.

Do you have any advice for me as to how to get to the bottom of this?

Many thanks,
Martin.

by (201 points)

1 Answer

0 votes

Ftp.dll was tested with large files, so the problem is rather on the server side. The biggest question is if the transfer of 1GB file starts or not.

Turn on logging, maybe something is there:
https://www.limilabs.com/blog/logging-in-ftp-dll

Try increasing timeout values:

client.ReceiveTimeout = TimeSpan.FromMinutes(1);
client.SendTimeout = TimeSpan.FromMinutes(1);

Turn on SSL/TLS - some AV software may be monitoring traffic and interrupting it if they find something suspicious.


Ftp.dll supports REST extension that allows it to resume the transfer starting at specified position. FTP server needs to support this extension as well.

You can use Ftp.Extensions.SupportsRestStream to check.

If it does, you need to know how much you uploaded: use Ftp.GetFileSize for that.

Then you can use FileStream, FileStream.Position and Ftp.Upload(string remotePath, long remoteStartPosition, Stream source) to upload.

by (297k points)
...