File transfers can fail for a variety of reasons, and often it is preferable to resume transfers rather than start transferring a file from the start - especially if the file is very large. Both uploads and downloads can be resumed, but it should be noted that resuming transfers is only supported for binary transfers. ASCII transfers cannot be resumed, as the offsets into the file can't be reliably calculated.
Resuming file transfers
Resuming normally depends on the presence of a local file, which is used to work out how many bytes remain to be transferred. For downloads, the local file is a partial file, and for uploads, the remote file is a partial file. Resuming the transfer is very simple - the following method is called prior to calling UploadFile or DownloadFile:
ftpConnection.ResumeNextTransfer()
When the next transfer is initiated via UploadFile or DownloadFile, it will use the existing local file to calculate the resume offset. Only the bytes beyond the offset will be transferred. This will not work with download methods that do not specify a local file, as the local file is needed to work out how much more remains to be downloaded. However an offset can be specified and used with all the download methods - see below.
Arbitrary resumption
Often, it is desirable to download from an arbitrary point in a file without actually resuming a previous download. This is done via the following method:
ftpConnection.ResumeNextDownload(offset)
The download begins not from the beginning of the remote file but from the offset. This is useful if the latter portion of a file is to be downloaded. This method can be used with any of the download methods.
This method can't be used with uploads, and isn't necessary because the user has control over local data. To resume an upload arbitrarily, simply supply the correct byte array as input, or the stream set to the correct offset. The append parameter can be used if the data is to be appended to an existing remote file. Note that the arbitrary resumption feature is included in edtFTPnet/PRO from version 8.0.0, which does not include the .NET 1.1 DLL.