I have an application built on RCP ( server on windows xp embedded) and has client Sessions kept on the server side as business objects.
Looking at :http://msdn.microsoft.com/en-us/library/windows/desktop/aa373939%28v=vs.85%29.aspx
I can see that there is built in mechanism for idle connection cleanup .
Is there a way I can set a callback function to be called when the idle connections are closed ?
To answer my own question , to detect when a connection is closing I have to create a server side client context somewhere at the opening of an client session and when the connection is interrupted/lost, a Server Context Run-down Routine is called .
For Example PCONTEXT_HANDLE_TYPE_rundown , where PCONTEXT_HANDLE_TYPE can be the type of your defined context if it is a complex data structure. The method uses name convention to rundown any number of contexts created TYPE1_rundown , TYPE2_rundown .. etc .
More info available here:
Client:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa373581%28v=vs.85%29.aspx
Server:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa378673%28v=vs.85%29.aspx