c# - WCF - Client callback vs. polling for "keep list of subscribers" -


After "text" itemprop = "text">

I want to create a simple client-server instance in WCF. I did some tests with callback, and it works fine till now. I played around a little with the following interface: [ServiceContract (SessionMode = SessionMode.Required, CallbackContract = typeof (IStringCallback))] Public Interface ISubscribeableService {[OperationContract] Zero ExecuteStringCallBack (string Values ​​); [Operation Contract] Subscribe to Server Information (Client Information C); [Operation Contract] Unsubscribe from server information (Client notification C); }

This is a simple example. Adjusted slightly, you can ask the server to reverse the server strings and subscribe to all the customer callback calls to "execute a string callback"

Now, here comes the question:. I want to implement a system where all the customers "register" with the server, and the server can "ask" if they are still alive, you will implement this with the callback (so instead of this "stringcallback "TellTheClientThatIAmStillHereCallback is a type of) By checking the communication status on the callback, if a customer is dead, then I can "know" something similar to this:

  Subscribers.ForEach (Representative (IStringCallback callback) {if ( (ICommunicationObject) callback) .State == CommunicationState.Opened) {callback.StringCallbackFunction (new string);} Other {subscriber (callback);}});  

Put my problem in another way: Plug

  • Server can be 3 clients
  • Customer dies one ( I pull the laptop)
  • The server dies and comes back online
  • a new customer comes

So basically, you Will be used to verify the callback "still living in the state" of customers, or you will use voting and keep track of "how long I have not heard of a customer After the text "itemprop =" text ">

you close off , after

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -