+1 vote

I am interested in the FTP component.

Do you have any samples of resuming FTP upload/download with a internet connection. Do you have any suggestions for handling resume when the internet connection is lost?

by

1 Answer

0 votes
 
Best answer

Use Upload or Download overloads, that take remoteStartPosition parameter.

In most simple case you would use:
Ftp.Upload(string remotePath, byte[] data)
To upload data.

On error (exception) you should create new Ftp object and connect again.

Then use Ftp.GetFileSize(string remotePath) to check how much data was
transferred and invoke Upload method with remoteStartPosition parameter:

if (client.FileExists("GetFileSize.txt"))
{
    long size = client.GetFileSize("file.txt");
    client.Upload("file.txt", size, data);
}
  • There are overloads that take stream as parameter.
  • If your server supports checksum verification,
    you can use Ftp.GetFileHash to verify hash of the uploaded data.
by (301k points)
...