It's just a guess, sounds like your multithreading isn't designed well. Can you explain your thread design in your own words? Arno Garrels
Guillaume MAISON wrote: > Le 20 May 2005 à 16:31, Guillaume MAISON a écrit: > >> Unless there's something obvious, i don't know why the ftpserver opens >> data for connection though i've set DelayedSend:=True in the >> OnGetProcessing event ? > After more and more debugging, i've found something : > when saying delayedSend to true, the data is, effectively, not sent. > But, the ftpserver keeps going on telling back to the client '150 opening > data, etc...'. > > the thing is that doing so, it fires the function > TCustomWSocket.Send(Data : Pointer; Len : Integer) : integer; > Which, in turns, post a message : > if bAllSent then begin > { We post a message to fire the FD_WRITE message wich in turn > will } > { fire the OnDataSent event. We cannot fire the event ourself > } > { because the event handler will eventually call send again. > } > { Sending the message prevent recursive call and stack overflow. > } > { The PostMessage function posts (places) a message in a window's > } > { message queue and then returns without waiting for the > } > { corresponding window to process the message. The message will > be } > { seen and routed by Delphi a litle later, when we will be out of > } > { the send function. > } > PostMessage(Handle, > WM_ASYNCSELECT, > FHSocket, > MakeLong(FD_WRITE, 0)); > end; > > This message is then received by the procedure > TCustomWSocket.Do_FD_WRITE(var msg: TMessage); > the thing is that, i have at the same time my thread which is kindly > retrieving data, but has nothing to send yet... > this Do_FD_WRITE procedure triggers the procedure > TFtpServer.ClientRetrDataSent(Sender : TObject; AError : Word); > var > Client : TFtpCtrlSocket; > Data : TWSocket; > begin > Data := TWSocket(Sender); > Client := TFtpCtrlSocket(Data.Owner); > > if Client.AbortingTransfer then > Exit; > > try > { Trigger the user event for the received data } > ==> TriggerRetrDataSent(Client, Data, AError); > > here is the problem... When this procedure (TriggerRetrDataSent) is > executed, it sends back to the client the fact that > the file has been sent. But the Client.Datastream is empty, so my client > application has retrieved a file, but empty. > But as i think that i have received a file, i go on my process > (disconnecting ==> which means on server side > that the client is destroyed and i have exceptions within my thread) and > analyzing the received (empty) content. > > Is this normal behavior or ? > > Guillaume MAISON > ----- > Guillaume MAISON - [EMAIL PROTECTED] > 83, Cours Victor Hugo > 47000 AGEN > Tél : 05 53 87 91 48 - Fax : 05 53 68 73 50 > e-mail : [EMAIL PROTECTED] - Web : http://nauteus.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be