Windows RCP 空闲连接清理
我有一个基于 RCP 构建的应用程序(嵌入式 Windows XP 上的服务器),并将客户端会话作为业务对象保留在服务器端。
查看:http:// msdn.microsoft.com/en-us/library/windows/desktop/aa373939%28v=vs.85%29.aspx 我可以看到有内置的空闲连接清理机制。 有没有办法可以设置在空闲连接关闭时调用的回调函数?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了回答我自己的问题,要检测连接何时关闭,我必须在客户端会话打开时的某处创建服务器端客户端上下文,并且当连接中断/丢失时,将调用服务器上下文运行例程。
例如 PCONTEXT_HANDLE_TYPE_rundown ,其中 PCONTEXT_HANDLE_TYPE 可以是您定义的上下文的类型(如果它是复杂的数据结构)。该方法使用名称约定来列出创建的任意数量的上下文 TYPE1_rundown 、 TYPE2_rundown .. 等。
更多信息请点击此处:
客户:
http://msdn.microsoft .com/en-us/library/windows/desktop/aa373581%28v=vs.85%29.aspx
服务器:
http://msdn.microsoft .com/en-us/library/windows/desktop/aa378673%28v=vs.85%29.aspx
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