如何释放端口? NET Remoting 中服务器端的职业?
在我的应用程序中,客户端可以从服务器端请求服务,而服务器可以将事件发送到客户端。
在.NET远程处理中,事件机制是通过双向通道实现的,而在这种情况下,实际的客户端扮演事件“服务器”的另一个角色。通常客户端会为这种通信打开一个空闲端口。
当我在服务器端运行 netstat CMD 时,我可以看到该服务器通过不同的端口与其他客户端建立了许多连接。
我的问题是,当某些客户端被关闭时,与这些客户端的上述端口的连接将不再可见。但实际上不是...
有人知道如何释放从服务器到客户端的连接吗?
In my application, client can request service from server side while server can send events to client side.
In .NET remoting the event mechanism is implemented by bi-directional channels, while in this case the actual client plays another role of "server" for events. Normally the client will open a free port for this kind of communication.
When I run the netstat CMD in server side, I can see this server established many connection to others clients via different ports.
My problem is when some clients are closed out, the connection to the above ports of those clients shall not be visible again. But actually not...
Anybody know how to release the connection from server to clients?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须处置您的连接对象。你做到了吗?
[编辑] 我的猜测是,此类对象确实打开了底层连接。这些对象应实现 IDisposable 接口,并且 .Dispose() 必须调用并释放对象所持有的资源(在您的情况下为连接/端口)。希望有帮助:-/
You have to dispose your connection objects. Did you do it ?
[EDIT] My guess is that such objects do have underlying connections open. Those objects shall implement the IDisposable interface and .Dispose() must called and release the resources (connections/ports in your case) hold by your objects. Hope that helps :-/