Solved

Multiple server callbacks to a single WCF client

Posted on 2010-09-20
5
909 Views
Last Modified: 2013-12-16
I have an application in which a single dashboard client listens to several servers, each of which controls a machine. Each of these controllers will send callbacks to a single method in the client.

In the WCF callback examples I've seen, the client is customized to a single server by means of the code generated by svcutil.exe. This won't suit for me since my client has to be able to handle a dynamically varying number of servers.

I've considered adding server code to my dashboard so that each controller sends it's messages to the client, but I'm not sure whether it's possible to be both client and server at the same time.
0
Comment
Question by:BlearyEye
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 33721284
Have you tried to subscribe your client to every server that requires to know a callback?
thus, every time a server fires a callback, your client code needs to handle it. It means that every server needs to have a publisher/subscriber mechanism as well.

Note: Callback samples (one server), but it can be use
http://idunno.org/archive/2008/05/29/wcf-callbacks-a-beginners-guide.aspx
http://www.devx.com/dotnet/Article/38814
0
 
LVL 1

Author Comment

by:BlearyEye
ID: 33721693
The main problem I see is that the examples I've looked at are pretty static (including the first link; the second one wanted me to register).

In these cases, you know in advance that you're going to be dealing with a given server and you know its address. So you run the utility to generate the C# code and config file for that particular server at its address. All this is pre-compile-time.

I need something that's dynamic, so that the servers can come and go. That's why I'm considering making the dashboard a server as well as a client, so servers can call the dashboard method.
0
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 33722026
How can the client knows there is a server available?
Are these servers having the same client proxy configuration? (Basically the only difference is the server address, not the binding or the contract)

In principle you can build the client generated code using reflection, but it would be a lot work for you.
0
 
LVL 1

Author Comment

by:BlearyEye
ID: 33774472
I agree.

I've tried the idea of the Client also functioning as a server to receive messages initiated by the Servers. This seems to work and is what I'm sticking with unless a better solution presents itself.
0
 
LVL 1

Accepted Solution

by:
BlearyEye earned 0 total points
ID: 33794540
So my final arrangement is

- Servers are WCF servers AND WCF clients
- Client is WCF client AND WCF server

This handles the many servers to one client problem that WCF callback does not adequately address
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question