views:

22

answers:

1

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, possibly 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?
A: 

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.

mafutrct
Since nobody brought up a different answer, I'm going to agree with myself.
mafutrct
Good choice. :)
GONeale