tags:

views:

26

answers:

1

I am setting up a nettcp WCF connection between a client and a server as a reliable session with a 7 day timeout. The client is monitoring a process on the server. Most of the activity is the service raising callbacks to the client. If the service crashes, how can the client detect this and display a "connection failed" message? Do I need to send some kind of keep alive message from the client to the server on a regular basis, or is there some event I can listen to on the client?

My binding code is:

     NetTcpBinding binding = new NetTcpBinding();
     var reliableSession = binding.ReliableSession;
     reliableSession.Enabled = true;
     reliableSession.Ordered = true;
A: 

Try subscribing to the Closed event of the client or channel. See CommunicationObject events.

John Saunders
But would this event be called because the server went down? How would the client/channel know that the server was dead, as opposed to just gone quiet?
Andrew Shepherd
@Andrew: not sure; I was hoping reliable session would do that, hence "try".
John Saunders