>> My program (a service) hosts 4 TWSocketServers in main thread.
>> Sometimes, when I ask the service to stop, the program freeze 
>> after I call TWSocketServer Close function

>You are assuming all sockets disconnect instantly and are the freeing
>the component, when activity may still be happening.  

>You should wait until there are zero clients on the server before
>freeing it.  Stop listening first, so new clients can not connect while
>you wait, at least one minute or more. 

This depict the most graceful, orderly shutdown and that is good.

Another possibility is to stop listening on the server socket (close) and
call Abort on each client socket and then call Abort on the server socket.
This should not block anything and quit quickly. Of course any connected
client will probably receive/experience an error because of abort.


--
francois.pie...@overbyte.be
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

Reply via email to