tags:

views:

21

answers:

1

I have a server process bound to a port that receives network packets at essentially random intervals. When a packet is received it is parsed and an object representing this packet's data is created. I would like to be able to 'push' this data object to any number, 0..n, client processes running on the same machine. The clients will always be on the localhost.

A client process is only interested in data objects created and pushed by the server since it was launched. This is also a one-way only flow of information. Client's do not need to communicate with the server they just need to receive any new data objects from the server.

The server and client processes are both written in C# using the .Net framework.

Given this setup, what method of IPC would you use to get this to work? My current plan is to serialize the data object and write it to a named pipe that clients read from. Is this the way to go? Also worth noting is that speed isn't a critical factor.

+1  A: 

I solved this using WCF callbacks. Clients 'subscribe' to the server, the server then iterates over the subscribed callbacks and calls them with the data to be pushed. When a client process is ended it issues an unsubscribe.

There are loads of examples of this on the net that are fairly easy to follow. For anyone interested these links might help.

http://msdn.microsoft.com/en-us/magazine/cc163537.aspx

http://dotnetaddict.dotnetdevelopersjournal.com/wcf_alarmclock.htm

http://idunno.org/archive/2008/05/29/wcf-callbacks-a-beginners-guide.aspx

Greg Sexton