User (Old forums)MemberJuly 29, 2011 at 2:11 pmPost count: 23064
I want to resume a file in process, that if I close the app and re-run it.
As stated in the title, I’m using the FtpClient.ReceiveMultipleFiles method
as sample of my code is below
Public Class mainGUI
Dim hostname As String = “my ip”
Dim username As String = “username”
Dim password As String = “password”
Public WithEvents Client As New FtpClient
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Private Sub OnSynchronizationProgression(ByVal sender As Object, ByVal e As SynchronizationProgressionEventArgs)
ProgressBar.Value = e.ByteProgression.Percent
Private Sub DownloadWorker_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles DownloadWorker.DoWork
Client.ReceiveMultipleFiles(“*”, Application.StartupPath & “/Download”, True, True)
Private Sub OnFileTransferStatus(ByVal sender As Object, ByVal e As FileTransferStatusEventArgs)
ProgressBar.Value = e.AllBytesPercent
Private Sub mainGUI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Client.SynchronizingObject = Me
Client.PassiveTransfer = True
Client.Timeout = “20”
AddHandler Client.FileTransferStatus, AddressOf Me.OnFileTransferStatus
Now all runs ok, but I want to be able to resume the download in progress if I close the form and return to it later on
How can I do this?
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Lup (had 1406 views)Xceed SupportMemberAugust 9, 2011 at 10:37 amPost count: 5658
> Now all runs ok, but I want to be able to resume the download in progress if I close the form and return to it later on
> How can I do this?
Then, you shouldn’t use FtpClient.ReceiveMultipleFiles(). There is no magic here:
You should download your files one by one with FtpClient.ReceiveFile().
Your application should track and remember each file that has been downloaded and the current one being downloaded.
That way, if you want to resume later, you can restart downloading the last file that was downloading.
can also restart your download at a specific offset in the remote file
with ReceiveFile() if you tracked the progress of the last downloading
file before the interruption.
ReceiveFile() flavors that support remote offsets:
Tracking the progress of a downloading file can be done with the FtpClient.FileTransferStatus event:
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Marc [Xceed] (had 1263 views)
- You must be logged in to reply to this topic.