Server detects crashed COM clients for clean shutdown... How? 
Author Message
 Server detects crashed COM clients for clean shutdown... How?

Hi,

I am working on a project that involves COM/DCOM client/server type coding.
I am not the most experienced
COM developer, so please excuse me if this is a dumb question!

My problem is this:

I have a client (console) which makes a connection to a server (.exe service
module). The server starts
running and everything is fine. Another console starts running, incrementing
the servers reference count.
Now one console crashes, and I mean total unclean crash, when the other
console shuts down, the server
remains running. It still has a reference count from the crashed client, but
this will never be released.

I am looking for some way of finding out, from inside the server, that the
client is no longer available.
For example, when a reference is released, the server checks to ensure there
is at least 1 client still
actively connected, i.e. it is still running. If there is no-one but
reference counts remain, it assumes
some clients have crashed and it self-destructs.

Our servers all have pump threads in them, and the only possibilty I have
right now is to have an event
interface with a Test() method in it. All clients implement this interface,
and simply respond to the
Test() event with a "return S_OK". Periodically the server fires the Test()
event to all connections,
if it does not receive a S_OK return it concludes the client is gone.

However, I am looking for a cleaner solution, preferably without requiring
any special coding or participation
from the client. I have been told that the "IObjectExporter" interface to
"ping" clients is the standard way of doing this, but I find no reference to
it in any files in the msdev installtion, and no real clue in the 1998 draft
found in MSDN ( searching for IObjectExporter ) as to exactly how to use
this interface and peform these ping operations.

Does anybody out there have any smart ideas or links to samples for doing
this?

Many thankx in advance,
Mark



Sun, 22 Feb 2004 14:29:08 GMT  
 Server detects crashed COM clients for clean shutdown... How?
Hello,

As far as I know, DCOM has its own garbage collection mechanism. The server
will keep ping the client in a fixed time period, if the client doesn't
respond. The server will assume that the client has been shut down for some
reason. I am not sure about the timeout value. It should be 3 minutes or
3*3=9 minutes.

You may have a try on this.

Regards,
Woody



Sun, 22 Feb 2004 20:46:57 GMT  
 Server detects crashed COM clients for clean shutdown... How?
The ping is every 2 minutes. Dead endpoints are confirmed after
3 unsuccessful pings. That totals 6 minutes.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================



Quote:
> Hello,

> As far as I know, DCOM has its own garbage collection mechanism. The
server
> will keep ping the client in a fixed time period, if the client doesn't
> respond. The server will assume that the client has been shut down for
some
> reason. I am not sure about the timeout value. It should be 3 minutes or
> 3*3=9 minutes.

> You may have a try on this.

> Regards,
> Woody



Mon, 23 Feb 2004 02:13:12 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Shutdown myself? ie shutdown a COM Server

2. COM client crashes calling COM method

3. CSocket , Server Shutdown, Client Receive problem

4. problems passing ADO Recordset from VB-COM client to VC-COM-Server dll

5. How to shutdown COM server without shutting down process

6. Shutdown EXE COM Server

7. (help request)server detecting client type...

8. Sockets - Detecting client closure from server side

9. multiple clients crash the server

10. Client Server problem: CLIENT printerDC not available on SERVER

11. Clean Shutdown of Application

12. Detecting if a certain COM server is registered via command line

 

 
Powered by phpBB® Forum Software