示例#1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="numConnections"></param>
        /// <param name="receiveBufferSize"></param>
        public Client(int receiveBufferSize)
        {
            IsRunning = false;
            this.receiveBufferSize = receiveBufferSize;
            bufferManager = new BufferManager(receiveBufferSize * opsToPreAlloc, receiveBufferSize);

            ReadWritePool = new SocketAsyncEventArgsPool(10);
        }
示例#2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="numConnections"></param>
        /// <param name="receiveBufferSize"></param>
        public Server(int numConnections, int receiveBufferSize)
        {
            IsRunning = false;
            totalBytesRead = 0;
            connectionsCount = 0;
            backlog = numConnections;
            maxConnectionsCount = numConnections;
            this.receiveBufferSize = receiveBufferSize;
            bufferManager = new BufferManager(receiveBufferSize * numConnections * opsToPreAlloc, receiveBufferSize);

            ReadWritePool = new SocketAsyncEventArgsPool(maxConnectionsCount);
            connectionsSemaphore = new Semaphore(maxConnectionsCount, maxConnectionsCount);
        }
示例#3
0
 /// <summary>
 /// 
 /// </summary>
 public void Dispose()
 {
     Stop();
     ReadWritePool = null;
 }