Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
923 views
in .NET FTP by (160 points)
edited by

In my program, I often meet a problem that the file downloading stops there because of many reasons. At this case, the whole file has to re-download in another running of the download code.

  As we known that, the edtFTPnet.dll supports the resume transfer if the transfer is broken using FTPConnection.ResumeNextTransfer Method. But I don't know exactly how to use this ResumeNextTransfer method? How to test the ResumeNextTransfer  is working? Can you please give me sample codes to explain how to use the this method to resume the transfer?

 Below code is my example, please help check the problem it has.
 

private void button1_Click(object sender, EventArgs e)
{
    try
    {
        ftpConnection.ServerAddress = "xx.xx.xx.xx";
        ftpConnection.UserName = "xxxxx";
        ftpConnection.Password = "xxxxx";
        ftpConnection.CommandEncoding = Encoding.GetEncoding("GB2312");
        ftpConnection.ConnectMode = FTPConnectMode.PASV;
        ftpConnection.TransferType = FTPTransferType.BINARY;
        ftpConnection.Connect();
        string[] filelist = ftpConnection.GetFiles();               
        if (ftpConnection.Exists("38384032.rmvb"))
        {
            ftpConnection.DownloadFile("d:\\38384032.rmvb", "38384032");
        }
    }
    catch (FTPException ftp)
    {               
        ftpConnection.ResumeNextTransfer();
    }
    catch (Exception ex)
    {                
    }
    finally
    {
        ftpConnection.Close();
    }

1 Answer

+1 vote
by (51.6k points)
selected by
 
Best answer

You simply need to call the ResumeNextTransfer() method and then call UploadFile again.  See here for more details.

by (160 points)
Amazing answer! Got it. Thank you so much!
by (51.6k points)
Glad to help.  Can you please click 'Best Answer' to select this answer?
by (160 points)
It's Done. Thank you

Categories

...