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.
精彩评论