[twsocket] Correct termination logic

2011-02-14 Thread David Lewis

Hi,

I am developing an application that uses both a 
TWSocketServer/TTcpSrvClient for TCP comms and a THttpCli to retrieve 
periodic images over HTTP. I'm doing this in C++ in BDS2006.


All components are created (new) in code, so not present on the forms, 
and then deleted in class destructors.


Now, before I added the THttpCli, everything was fine. Startup, normal 
comms operation, and shutdown went without a hitch and no exceptions 
fire. Even Codeguard was happy.


However, now I've added the THttpCli component,  I can't find a way to 
shutdown the application without exceptions  lockups.


In normal operation, the component works. It will retrieve images (every 
30 seconds [TTimer] from a video server) if the network is up, 
OnSocketError fires if the connection is down.


But, when I try to terminate the program, I can't get a clean shutdown. 
Depending on what I've tried, I get exceptions or lockups/hangs.


Deleting the component the moment the class destructor is called fails, 
as the component could be in the middle of an operation (I am in a high 
latency environment). Calling Abort() at this time seems to just hang 
(the operational routine I have ever returns from the component).


What is the 'correct' way to cleanly shutdown the THttpCli component, 
whilst it could be in use?


Thanks,

Dave



--
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


Re: [twsocket] Correct termination logic

2011-02-14 Thread Francois PIETTE
What is the 'correct' way to cleanly shutdown the THttpCli component, 
whilst it could be in use?


Set all events to nil and call 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