I know there are tutorials out there regarding WCF callbacks and events, but I'm having trouble getting them to actually work, or they're too complex. I'm a real beginner, so I would love to hear if anyone knows of any solid beginner tutorials that are aimed to what I'm trying to specifically figure out at the moment. Please forgive me if I use the wrong terminology (and please correct me), like I said I'm a beginner.
The Problem:
It might look more complicated than it really is. Basically what I'm trying to accomplish is:
- A Host with some local memory (lets say an array of 5 integers) and running a WCF service. that will listen for queries from the client AND fire an update (events?) to the client when one of these integers are changed (from an external source, such as user input via command prompt and Set()).
- A Client that can make direct queries to return one of these five integers or subscribe to a particular index of the host array.
What I Can Do:
I can set up the connection, but my service is limited to standalone functions. The client can make "queries", but is limited to remote function calling (such as "add", where all parameters are passed with the function and the processing is done internally).
What I'm Trying To Figure Out:
- How can I access some variables held in the host memory from the service contract functions? For example, how can I call a method from the client GetInt() that would simply return something stored in the application memory on the host?
- How can I push a "message" to the client from the host? For example, in the host, call TellClient(int x), which would call some function on the client side? Is this possible without running a service on both sides?
TLDR:
Host : Service <-> Client. Is there a way to push data (simply an int) to the client without the client calling any functions (no polling or queries)? Is there a way to have the WCF service access variables stored in instance of the host application without using static members? Can this be accomplished in a simple way?
Thanks for your help and time, I know I wrote a book. If anyone knows of any nice tutorials, please point me to them. But PLEASE - Don't point me to the Add(int x, int y) example where the client just calls add on the host and returns the result - I've already done this a few times over and it's not helping me grasp the real functionality of WCF. I'm really not trying to accomplish anything serious at this point, I'm really trying to keep it simple so I can learn what WCF can do, and I'm not finding the documentation to be very helpful. Thanks again everybody.