Solved

Multiple server callbacks to a single WCF client

Posted on 2010-09-20
5
887 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
  • 3
  • 2
5 Comments
 
LVL 35

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 35

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now