views:

70

answers:

1

I have a Windows Service (implemented in C#) and I have something like a service control manager. I would like to trace messages from the service to the service control manager (which is a window forms application), but I'm not sure what's the best way for doing this. The service should broadcast the messages to all clients who are listning in a nonblocking manner.

I have considerd using named pipes or mailslots, but i'm not sure if there is a better way for doing this (I'm also not sure if I can implement the broadcating with this technology).

Any advice would be greatly apreciated.

A: 

If there are multiple clients listening, I think named pipes would be a little more work. I think shared memory would be simpler for that situation. If the clients might be on a separate machine, something like multicast might be a simple way to transmit the information if there is not a lot of data involved. However, multicast range is typically limited to a single subnet unless the routers are specifically configured for multicast.

Mark Wilkins
Thanks for the reply. The clients are all on the same machine, therefore I would like to avoid involving the network stack. Shared memory sounds like an option. But I wounder if it is also possibe to use windows messages for this (although they seem a bit cumbersome to use in C#)
I agree with your assessment of avoiding the network in that case. Another possibility that might be more flexible especially for future updates would be to use .Net Remoting (http://msdn.microsoft.com/en-us/library/kwdt6w2k(VS.71).aspx). That is probably the "officially" correct way to do it.
Mark Wilkins