Example #1
0
        /// <summary> Send a packet to this Port.
        /// The thread is suspended if no capacity is currently available.
        /// If the port or connection has been closed, <code>false</code> is
        /// returned; otherwise, <code>true</code> is returned.
        /// <p> Do not reference the packet after sending - someone else may be
        /// modifying it!
        /// </summary>
        /// <param name="packet">packet to send
        /// </param>
        /// <returns>true if successful
        /// *
        /// </returns>

        // The send function.
        public virtual void Send(Packet packet)
        {
            bool res = true;
            Trace("Sending: " + packet.ToString());
            _sender.CheckOwner(packet);

            if (isClosed)
            {

                Trace("Sending - port closed");
                res = false;
            }
            res &= _cnxt.Send(packet, this); // fire up send method on connection

            if (!res)
                FlowError.Complain("Could not deliver packet to " + Name);
           Trace("Sent OK");

            return;
        }