I am writing a Com server and I have wrote code that detect situation when COM client was closed unexpectedly, in this case I should close COM server inside COM server code.
How can I do this?
UPD: I have situations when COM server is hanged or more correctly I can't attach to COM server from COM client, but application that contains COM server is alive, so I think that COM server can detect that all old COM clients was disconnected/closed/crashed and application will restart because no new clients attached.
I have write the following code in COM client in separate thread
while(not we are closing)
{
unknown->QueryInterface(IComServer, &server);
if (server)
return;
}
so the COM client can wait until server will really ready to work
UPD2: Just tested: after 12 minutes my COM server was closed