a_jam_sandwich Posted February 8, 2004 Posted February 8, 2004 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. 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 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 Quote Code today gone tomorrow!
a_jam_sandwich Posted February 10, 2004 Author Posted February 10, 2004 Doesn't anyone know? Andy Quote Code today gone tomorrow!
a_jam_sandwich Posted February 10, 2004 Author Posted February 10, 2004 Well apart from the above ... and the above only seams to happen on one ftp server strange :? anyway find attached a usable version on the control with a small client also wrote to see how to use it anyway its fairly simple to use you can download/upload a file just using 6 lines of code for example Dim MyFTP As New classFTP If MyFTP.Connect("ftp.microsoft.com", "anonymouse", "test@test.com", "reskit/win2000") Then MyFTP.DownloadFile("now.zip", "now.zip") Else MsgBox("Could not connect", MsgBoxStyle.Information, "Error Connecting") End If Anyway please feel free to change/modify it. If this control helps please tell me. Andy p.s I know there are some bugs in getting the Directory listings from a couple of severs I am working on this.ftp.zip Quote Code today gone tomorrow!
Administrators PlausiblyDamp Posted February 10, 2004 Administrators Posted February 10, 2004 Very nice so far, only had a quick look but I'm impressed. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
a_jam_sandwich Posted February 10, 2004 Author Posted February 10, 2004 Thank you greatly appreciated Quote Code today gone tomorrow!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.