Is there any way to check the status of the RPC connection from the server-side? I am looking for a way to detect if the connection from the client is lost, be it client crash or other connectivity issues.
+4
A:
Use Context Handles for managing server state between calls for a particular client. RPC uses keep-alive's to detect client disconnects and will execute your context handle rundown routine if the client disconnects.
Mo Flanagan
2009-02-26 13:14:46
+1
A:
Mo Flanagan's answer is the best IMHO. Some more context.
If you're using binding handles, there is no way of tracking state across RPC calls and the concept of a "client disconnect" is essentially meaningless - you still need to return from the RPC call.
If you're using context handles, then the RPC runtime library will call the _rundown function when the client disconnects.
When that routine is called, the server can clean up whatever it needs to.
Larry Osterman
2009-02-27 00:26:43
I just had to answer this one for old times sake. I used to work on the RPC team at MSFT, this brought back memories of RPCDBG ;)
Mo Flanagan
2009-03-11 14:14:16