コード例 #1
0
 public TcpClientPacketProtocol(int bufferSize, int bufferPoolSize,ILoger loger)
 {
     this.loger = loger;
     if (BufferPool == null)
         BufferPool = new FixedBufferPool(bufferSize,bufferPoolSize);
     ReceiveBuffers = new Queue<IFixedBuffer>();
     SendBuffer = new FixedBuffer(bufferPoolSize);
 }
コード例 #2
0
        private ConcurrentQueue<SendData> sendDataQueue = new ConcurrentQueue<SendData>(); //指令发送队列

        #endregion Fields

        #region Constructors

        public TcpClientPacketProtocol(int bufferSize, int fixedBufferPoolSize)
        {
            if (BufferPool == null)
            {
                lock(closeLock)
                {
                    if(BufferPool==null)
                        BufferPool = new FixedBufferPool(fixedBufferPoolSize, bufferSize);
                }
            }
            ReceiveBuffers = new Queue<IFixedBuffer>();
            SendBuffer = new FixedBuffer(bufferSize);
            ReceiveDataBuffer = new DynamicBuffer(bufferSize);
        }