Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Multiple server callbacks to a single WCF client

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

Technology Partners: 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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

730 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