Board index » delphi » DCOM object detecting client death

DCOM object detecting client death

I'm looking for suggestions on how a DCOM server can detect and handle when
the associated client dies (app crashes, user just turns off machine,
whatever).  The interface includes a ping function so I have a pretty quick
timer to know when the client is not responding anymore.  The method I use
now is basically to 'nil' out the copy of the object on the server side.
The problem is that when this happens the server app gets a runtime 217
error on exit.

Any suggestions or pointers?

 

Re:DCOM object detecting client death


Hello !

How do you 'nil out the copy of the object on the server side' ? because I'd
rather say you get a callback interface from the client on the server side
and not a copy of the object.

I think your problem is that each time you set an interface reference to
nil, Delphi issues a _Release along the interface it references. So if you
explicitely destroy a Delphi instance without first releasing all other
references your application holds it will crash (firing a GPF) when the
forgotten reference goes out of scope. In order to reset it bybpassing the
hidden _Release you can typecast your interface as a pointer and then set it
to nil.

If you can provide some more details, it would probably be easier to help
you.

Patrice Corteel

*************************************************
Patrice CORTEEL - pcort...@itecor.com
Information Technology Software
30, quai de Dion Bouton
92806 PUTEAUX CEDEX
FRANCE
Tel 33.(0)1.41.02.84.84
Fax 33.(0)1.49.00.49.42
*************************************************

John Keene a crit dans le message <6eq7ip$1...@forums.borland.com>...

Quote
>I'm looking for suggestions on how a DCOM server can detect and handle when
>the associated client dies (app crashes, user just turns off machine,
>whatever).  The interface includes a ping function so I have a pretty quick
>timer to know when the client is not responding anymore.  The method I use
>now is basically to 'nil' out the copy of the object on the server side.
>The problem is that when this happens the server app gets a runtime 217
>error on exit.

>Any suggestions or pointers?

Other Threads