> MySocket.Close; > repeat > Sleep(10); > until MySocket.State = wsClosed;
Beside the good answer given by Arno, I would say that the above code is really not recommanded for the following reason: You should not wait on the State property but instead use the events. And if you really, really wants to use a wait loop, using only Sleep() within it prevent any event from being dispatched. This is usually bad. You have to call the message pump and make sure to not reenter event handlers or strange things will happend. Your wait loop may lock the thread forever if for some reason the state is never changed to wsClosed. You should implement a timeout mechanism. btw: Think event driven ! -- [EMAIL PROTECTED] The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- 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