示例#1
0
 /// <summary>
 /// 客户端初始化
 /// </summary>
 /// <param name="poolCount"></param>
 /// <param name="bufferSize"></param>
 public static void Init(int poolCount, int bufferSize)
 {
     _varListPool       = new VarListPool(poolCount);
     _sendBufferPool    = new DataBufferPool(poolCount, bufferSize);
     _sendBigBufferPool = new DataBufferPool(100, bufferSize * 10);
     _packageHeadPool   = new PackageHeadPool(poolCount);
     //_recvBufferPool = new DataBufferPool(poolCount, bufferSize);
     _poolOfRecSendEventArgs = new SocketAsyncEventArgsPool();
 }
示例#2
0
        //static SocketHelper()
        //{
        //    _varListPool = new VarListPool(CfgMgr.BasicCfg.MaxNumberOfConnections);
        //}

        /// <summary>
        /// 服务端初始化
        /// </summary>
        public static void Init()
        {
            _sendBufferPool    = new DataBufferPool(CfgMgr.BasicCfg.MaxNumberOfConnections + CfgMgr.BasicCfg.ExcessSaeaObjectsInPool, CfgMgr.BasicCfg.BufferSize);
            _sendBigBufferPool = new DataBufferPool(CfgMgr.BasicCfg.BigBufferCount, CfgMgr.BasicCfg.BufferSize * 10);
            _packageHeadPool   = new PackageHeadPool(CfgMgr.BasicCfg.MaxNumberOfConnections);
            //_recvBufferPool = new DataBufferPool(CfgMgr.BasicCfg.MaxNumberOfConnections + CfgMgr.BasicCfg.ExcessSaeaObjectsInPool,CfgMgr.BasicCfg.BufferSize);
            _poolOfRecSendEventArgs = new SocketAsyncEventArgsPool();
            _poolOfAcceptEventArgs  = new SocketAsyncEventArgsPool();
        }