public bool ClearFirstPacket()
        {
            if (_sendBufferList.Count <= 0)
            {
                return(false);
            }
            int count = _sendBufferList[0].Count;

            _dynamicBufferManager.Clear(count);
            _sendBufferList.RemoveAt(0);
            return(true);
        }
Example #2
0
        private bool ProcessReceive(byte[] buffer, int offset, int count)
        {
            DynamicBufferManager receiveBuffer = _userToken.ReceiveBuffer;

            receiveBuffer.WriteBuffer(buffer, offset, count);

            if (receiveBuffer.DataCount >= sizeof(UInt16) + sizeof(UInt32))
            {
                bool result = ProcessPacket(receiveBuffer.Buffer, offset, count);
                if (result)
                {
                    receiveBuffer.Clear(count);
                }
                return(result);
            }
            return(true);
        }