DZ-Jay wrote: > On Dec 6, 2007, at 05:39, Arno Garrels wrote: > >> I think it helps to disconnect all, then destroy the server >> object after all clients have been actually disconnected. > > I'll look into this, but as far as I recall (I have no access to the > source code right now), the TWSocketThrdServer destructor calls > DisconnectAll which does this.
Not in my sources. It posts a message to tell the threads that they shall terminate. When a thread terminates clients are just ThreadDetached. > And (as I seem to recall also), it > uses WaitForMultipleObjects() until the clients notify that they have > finished and frees them. It waits until all worker threads are finished thus all client's HWND is 0, that may cause the problem. > What I'm saying is that I was under the impression that the server > class was handling the disconnection of all clients when destroyed. > If this is not true, then I can build it into my application, no > problem; but if it is true, then that means there may be something > wrong in the code. The problem is that TriggerSessionClosed won't be called when you disconnect a client from server's destructor or from a destructor of its owner since csDestroying would be in component states (see InternalClose). I guess it's worth a trial to simply ThreadAttach all clients in the destructor after all threads terminated. .. until FThreadList.Count = 0; ==>for I := ClientCount -1 downto 0 do ==> Client[I].ThreadAttach; -- Arno Garrels I'll see what I can find when I get to the office > later on. > > dZ. > > -- > DZ-Jay [TeamICS] > http://www.overbyte.be/eng/overbyte/teamics.html -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be