I believe I solved it: It turns out that my application was intercepting the WM_CLIENT_CLOSED message mistakenly.
My application use TWSocketServer within a worker thread, and this worker thread has a custom message dispatcher so that it can process messages sent to the thread without a hidden window. The problem was that I forgot to check if the Msg.HWND property was 0 before calling the custom dispatcher. Since I solved my own problem, and it has nothing to do with TWSocket, this message is not Off Topic. -dZ. >------- Original Message ------- >From : [EMAIL PROTECTED]:[EMAIL PROTECTED] >Sent : 10/17/2007 2:36:00 PM >To : twsocket@elists.org >Cc : >Subject : RE: Re: [twsocket] TWSocketServer Client.Shutdown(1) does not destroy it > >Hello: Its worse... I also noticed that TWSocketClient.TriggerSessionClosed() is triggered by the client, but the message posted is never received by the server. This happens even then the client drops the connection. So, for some reason, the clients are never destroyed. I'm sure that its something to do with my code, but can anybody offer some suggestions as to what may cause this behaviour? Thanks, -dZ. >------- Original Message ------- >From : [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] >Sent : 10/17/2007 2:06:48 PM >To : twsocket@elists.org >Cc : >Subject : RE: [twsocket] TWSocketServer Client.Shutdown(1) does not destroy it > >Hello: I just started noticing this behaviour today, and I seem to recall it working differently: When handling the OnClientDataAvailable event, if I determine that the client needs to be disconnected, I call (Sender As TMyClient).Shutdown(1). The connection is dropped fine, but the client object is never freed until the server shuts down completely. Here's a sample of my code: Procedure TMyServer.ClientDataAvailable(Sender: TObject; Error: Word); Begin With (Sender As TMyClient) Do Begin If (SomethingBadHappened) Then Begin SendLine('Error!'); Shutdown(1); End; End; End; I call Shutdown(1) so that the connection is dropped gracefully and the error response is received by the client. I don't recall changing this recently, so I'm confused as to why it would have been destroying the client before and not now (I may have changed some of the default properties, though I don't recall anything pertinent to this issue). Perhaps there's an even better way? Thanks for the help, -dZ. -- 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 -- 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