Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.5k views
in .NET FTP by (700 points)
Hi,

I am using the asynch method of DownloadMultiple to download all files with wildcard *.csv from an FTP server. The problem is that although no errors are appearing, the file in the local folder never gets overwritten. Only the first time only. What could I be doing wrong here? I also tried the same with synchronous methods and got the same result. Here is my code:


'Open Connection
With FTPConnection
            .ServerAddress = txtIP.Text
            .UserName = txtUser.Text
            .Password = txtPass.Text
            Try
                .BeginConnect(New AsyncCallback(AddressOf OnConnect), FTPConnection)
                .BeginChangeWorkingDirectory("backup", New AsyncCallback(AddressOf OnChangeDirectory), FTPConnection)
            Catch ex As Exception
                MessageBox.Show("An error occurred while trying to connect to the exchange rate server. The error is :" + ex.Message)
            End Try
        End With

      
'Download files
FTPCon.BeginDownloadMultiple(txtLocalPath.Text, FTPCon.ServerDirectory, "*.csv", False, New AsyncCallback(AddressOf OnDownloadMultiple), FTPCon)

                  
Private Sub OnConnect(ByVal ar As IAsyncResult)
        Dim c As ExFTPConnection = CType(ar.AsyncState, ExFTPConnection)
        c.EndConnect(ar)
Console.WriteLine("Connect completed")

End Sub 'OnConnect


Private Sub OnChangeDirectory(ByVal ar As IAsyncResult)
        Dim c As ExFTPConnection = CType(ar.AsyncState, ExFTPConnection)
        c.EndChangeWorkingDirectory(ar)
        Console.WriteLine("Changed directory completed")
End Sub 'OnUpload


Private Sub OnDownloadMultiple(ByVal ar As IAsyncResult)
        Dim c As ExFTPConnection = CType(ar.AsyncState, ExFTPConnection)
        c.EndDownloadMultiple(ar)
        Console.WriteLine("Download filtered files completed")
End Sub 'OnDownload


Private Sub OnClose(ByVal ar As IAsyncResult)
        Dim c As ExFTPConnection = CType(ar.AsyncState, ExFTPConnection)
        c.EndClose(ar)
        Console.WriteLine("Close completed.  Signalling main thread")
        signaller.Set()
End Sub 'OnClose

Private signaller As New ManualResetEvent(False)


thanks

1 Answer

0 votes
by (162k points)
Hi, could you please enable logging at the All level and email it to us (zipped up) - support at enterprisedt dot com

Categories

...