a_jam_sandwich
Well-known member
I have a problem with receiving files on a socket for some reason hopefully someone will know why.
After connecting to a ftp sever I download files using the following code.
The problem is SOMETIMES not all the time when downloading files, the program will hang on the line
And the program will freeze waiting for PasvSocket to receive anything. This does not happen all the time and therefore I am completely baffeled.
Any ideas? Many thanks
Andy
After connecting to a ftp sever I download files using the following code.
Code:
Do
BytesRemaining = PasvSocket.Receive(ReceiveBuffer, 512, SocketFlags.None)
BytesReceived += BytesRemaining
MyFile.Write(ReceiveBuffer, 0, BytesRemaining)
RaiseEvent DownloadProgress(RemoteFilename, BytesReceived, FileSize)
Application.DoEvents()
Loop Until (BytesRemaining = 0)
The problem is SOMETIMES not all the time when downloading files, the program will hang on the line
Code:
BytesRemaining = PasvSocket.Receive(ReceiveBuffer, 512, SocketFlags.None)
And the program will freeze waiting for PasvSocket to receive anything. This does not happen all the time and therefore I am completely baffeled.
Any ideas? Many thanks
Andy