Hi:
I'm writing an application which downolads a file from a remote server by FTP
this is my code
______________________________________________________________________________________
Dim ftpURI As String = "ftp://205.134.48.217/"
Try
Dim filename As String = ftpURI & "Digital/sounds/SOUND0608191550.WAV"
Dim client As New WebClient()
client.Credentials = New NetworkCredential("user1", "password1")
My.Computer.FileSystem.WriteAllBytes("C:\hello\SOUND0608191550.WAV", client.DownloadData(filename), False)
MsgBox("File downloaded!")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
______________________________________________________________________________________
I get an "System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive" most of times at client.DownloadData function but other times it works well.
The size of SOUND0608191550.WAV is 5 MB.
When I try to download a smaller file (1 KB) from the remote server the application works successfully.
When I try to download SOUND0608191550.WAV from a local server the application works successfully too.
What could be wrong?
I suppose the problem is the bandwidth and/or the time out and this is the reason why the application sometimes works and other does not.
do I need to setup something on the server or my PC?
Thanks!!
I'm writing an application which downolads a file from a remote server by FTP
this is my code
______________________________________________________________________________________
Dim ftpURI As String = "ftp://205.134.48.217/"
Try
Dim filename As String = ftpURI & "Digital/sounds/SOUND0608191550.WAV"
Dim client As New WebClient()
client.Credentials = New NetworkCredential("user1", "password1")
My.Computer.FileSystem.WriteAllBytes("C:\hello\SOUND0608191550.WAV", client.DownloadData(filename), False)
MsgBox("File downloaded!")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
______________________________________________________________________________________
I get an "System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive" most of times at client.DownloadData function but other times it works well.
The size of SOUND0608191550.WAV is 5 MB.
When I try to download a smaller file (1 KB) from the remote server the application works successfully.
When I try to download SOUND0608191550.WAV from a local server the application works successfully too.
What could be wrong?
I suppose the problem is the bandwidth and/or the time out and this is the reason why the application sometimes works and other does not.
do I need to setup something on the server or my PC?
Thanks!!