开发者

How can I tell that a NetTcp-based WCF connection was interrupted?

A WCF service is based on NetTcpBinding. It may happen that a client silently vanishes, leaving the server without knowledge that it is not connected anymore.

I'm currently using a thread that pings all connected client to see if they are still alive, and removes disconnected clients.

  • Is a ping thread the correct way to solve the issue, or is there a better, possibl开发者_高级运维y event-based way?
  • Do I have to surround every code that communicates with the client by try/catch and remove it from the list of connected clients additionally?


I believe I found the answer myself.

There is an event OperationContext.Current.Channel.Closing that is fired on faulted as well as closed connections.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜