Thanks, Wilfried. That's what I'm doing now. However, I'm doing it from the end of the Execute() method of the worker thread, right before destroying the server, like this:
Procedure WorkerThread.Execute; Begin _InitializeSrv(); // create Try Srv.MessageLoop(); Finally Try For n := 0 to (Srv.ClientCount - 1) Do Begin Srv.Clients[n].SendStr('bye'#13#10); Srv.Clients[n].ShutDown(1); End; Finally Srv.Free; End; End; End; The problem that I saw was that Calling Shutdown(1) would cause the server to trigger OnClientDisconnect, which may fire *after* the thread and client were distroyed by Srv.Free, which will raise an exception that I would like to avoid if possible. So, what I did was not call ShutDown(1), and expect the shutdown to occur when destroying the Srv, like this: Try Srv.Shutdown(0); // make sure we do not accept anybody else! For n := 0 to (Srv.ClientCount - 1) Do Begin Srv.Clients[n].SendStr('bye'#13#10); End; Finally Srv.Free; // Shutdown clients as well End; Is that appropriate, or can you see something wrong with it? Thanks! dZ. P.S. I haven't received any messages from this list in the past two days. Is it still alive, or am I having e-mail issues? -- 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