Example #1
0
        /// <summary>
        /// This method attempts to send the message passed to the named inbox.
        /// Note that there is no guarantee that the message is actually received
        /// by the inbox.  This method is threadsafe.
        /// </summary>
        /// <param name="name">Name of the destination inbox.  The name is case sensitive.</param>
        /// <param name="message">The message.</param>
        /// <returns><c>true</c> if there was an inbox listening for messages.</returns>
        public bool Send(string name, byte[] message)
        {
            InboxRef inbox;

            lock (syncLock)
            {
                inbox = (InboxRef)inboxes[name];
                if (inbox == null)
                {
                    inbox = new InboxRef(name, maxMsgSize);
                    inboxes.Add(name, inbox);
                }
            }

            return(inbox.Send(message, maxWait));
        }
Example #2
0
        /// <summary>
        /// This method returns <c>true</c> if the named inbox exists and is ready to
        /// accept message transmissions.
        /// </summary>
        public bool IsReady(string name)
        {
            InboxRef inbox;

            lock (syncLock)
            {
                inbox = (InboxRef)inboxes[name];
                if (inbox == null)
                {
                    inbox = new InboxRef(name, maxMsgSize);
                    inboxes.Add(name, inbox);
                }
            }

            return(inbox.Send(null, maxWait));
        }