예제 #1
0
        /// <summary>
        /// Sends the data segments to clinet.
        /// </summary>
        /// <param name="segments">The segments.</param>
        /// <returns>Indicate whether the message was pushed into the sending queue</returns>
        public virtual bool Send(IList <ArraySegment <byte> > segments)
        {
            if (!GetSendingQueue().Enqueue(segments))
            {
                return(false);
            }

            SocketSession.StartSend();
            LastActiveTime = DateTime.Now;

            return(true);
        }
예제 #2
0
        private bool InternalTrySend(IList <ArraySegment <byte> > segments)
        {
            if (!m_Connected)
            {
                throw new Exception(CANNOT_SEND_NOT_CONNECTED);
            }

            if (!GetSendingQueue().Enqueue(segments))
            {
                return(false);
            }

            SocketSession.StartSend();
            LastActiveTime = DateTime.Now;

            return(true);
        }