Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Multiple server callbacks to a single WCF client

Posted on 2010-09-20
5
Medium Priority
?
929 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 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

927 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