c++ - How can I perform network IO at the very end of a process' lifetime? -


I am developing a DLL in C ++ through which some data (pre-installed) TCP / IP connection You have to write through the book. To be precise, DLL should send a little 'process 12345 to end on 2007-09-27 15:30:42, the value of i is 131' on the message wire when the process goes down.

Unfortunately, I know that the process is ending, all the ways are known to find out that any network call is too late to succeed, in particular I have the following Tried methods and returned 1 call in each case:

  1. Calling the destruction of a global object.
  2. Callback function by calling registered.
  3. Calling (if causes argument DLL_PROCESS_DETACH ) I know that this is not a safe thing to do, but I am feeling a little frustrated: -)

I know that a DLL any Process shutdown (This process may be loaded before expiry) Shutdown data which needs to be sent to DLL, depends on DLL on other code, which is acceptable. I am basically looking for the latest moment, on which I can safely come to the network.

Does anyone know this?

Determination to Exit a Process:

Tutorial: Managing a Windows Process:


Comments