Example #1
0
 public UdpServer(UdpConfig config, ILoger loger)
 {
     this.Config          = config;
     this.Loger           = loger;
     sendArgsPool         = new EventArgsPool(config.MaxSendEventArgs);
     receiveEventArgsList = new List <SocketAsyncEventArgs>(config.ListenerThreads);
     BufferPool           = new FixedBufferPool(config.MaxFixedBufferPoolSize, config.BufferSize);
 }
 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);
 }
Example #3
0
 public UdpServer(UdpConfig config, ILoger loger)
 {
     this.Config = config;
     this.Loger = loger;
     sendArgsPool = new EventArgsPool(config.MaxSendEventArgs);
     receiveEventArgsList = new List<SocketAsyncEventArgs>(config.ListenerThreads);
     BufferPool = new FixedBufferPool(config.MaxFixedBufferPoolSize, config.BufferSize);
 }
Example #4
0
 private Queue <SendCommond> cmdQueue = new Queue <SendCommond>(); //指令发送队列
 public TcpPacketProtocol(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);
 }
Example #5
0
 public RUdpServer(RUdpServerConfig config, ILoger loger)
 {
     Config = config;
     Loger = loger;
     SessionPool = new RUdpSessionPool();
     SessionPool.RUdpServer = this;
     receiveEventArgsList = new List<SocketAsyncEventArgs>(config.ListenerThreads);
     SocketArgsPool = new EventArgsPool(config.MaxSendEventArgs);
     BufferPool = new FixedBufferPool(config.MaxFixedBufferPoolSize, config.BufferSize);
 }
Example #6
0
 public RUdpServer(RUdpServerConfig config, ILoger loger)
 {
     Config                 = config;
     Loger                  = loger;
     SessionPool            = new RUdpSessionPool();
     SessionPool.RUdpServer = this;
     receiveEventArgsList   = new List <SocketAsyncEventArgs>(config.ListenerThreads);
     SocketArgsPool         = new EventArgsPool(config.MaxSendEventArgs);
     BufferPool             = new FixedBufferPool(config.MaxFixedBufferPoolSize, config.BufferSize);
 }
        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);
        }
 private ConcurrentQueue <SendData> sendDataQueue = new ConcurrentQueue <SendData>(); //指令发送队列
 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);
 }