Click here to Skip to main content
15,896,154 members
Articles / Programming Languages / C#

.NET Interprocess Communication Revisited

Rate me:
Please Sign up or sign in to vote.
4.96/5 (30 votes)
4 Jan 2010CPOL4 min read 122.2K   2.3K   111  
The XDMessaging 2.0 library provides an easy-to-use, zero configuration alternative to existing IPC implementations.
/*=============================================================================
*
*	(C) Copyright 2007, Michael Carlisle (mike.carlisle@thecodeking.co.uk)
*
*   http://www.TheCodeKing.co.uk
*  
*	All rights reserved.
*	The code and information is provided "as-is" without waranty of any kind,
*	either expressed or implied.
*
*=============================================================================
*/
using System;
using System.Collections.Generic;
using System.Text;

namespace TheCodeKing.Net.Messaging.Concrete.MultiBroadcast
{
    /// <summary>
    /// An implementation of IXDBroadcast that encapsulates multiple broadcast instances
    /// so that messages can be send using multiple modes.
    /// </summary>
    internal sealed class XDMultiBroadcast : IXDBroadcast
    {
        /// <summary>
        /// The list of IXDBraodcast instances used to broadcast from this instance.
        /// </summary>
        private IEnumerable<IXDBroadcast> broadcastInstances;

        /// <summary>
        /// The constructor which takes an IEnumerable list of IXDBroadcast instances.
        /// </summary>
        /// <param name="broadcastInstances"></param>
        internal XDMultiBroadcast(IEnumerable<IXDBroadcast> broadcastInstances)
        {
            this.broadcastInstances = broadcastInstances;
        }
        /// <summary>
        /// The implementation of IXDBroadcast used to send messages in 
        /// multiple modes.
        /// </summary>
        /// <param name="channel"></param>
        /// <param name="message"></param>
        public void SendToChannel(string channel, string message)
        {
            foreach (IXDBroadcast broadcast in broadcastInstances)
            {
                broadcast.SendToChannel(channel, message);
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
United Kingdom United Kingdom
Mike Carlisle - Technical Architect with over 20 years experience in a wide range of technologies.

@TheCodeKing

Comments and Discussions