Beispiel #1
0
        public SocketTestServerAsync(int numConnections, int receiveBufferSize, EndPoint localEndPoint)
        {
            _log                 = VerboseTestLogging.GetInstance();
            _totalBytesRead      = 0;
            _numConnectedSockets = 0;
            _maxNumConnections   = numConnections;
            _receiveBufferSize   = receiveBufferSize;

            // Allocate buffers such that the maximum number of sockets can have one outstanding read and
            // write posted to the socket simultaneously.
            _bufferManager = new BufferManager(receiveBufferSize * numConnections * OpsToPreAlloc,
                                               receiveBufferSize);

            _readWritePool = new SocketAsyncEventArgsPool(numConnections);
            _maxNumberAcceptedClientsSemaphore = new Semaphore(numConnections, numConnections);
            Init();
            Start(localEndPoint);
        }
        public SocketTestServerAsync(int numConnections, int receiveBufferSize, EndPoint localEndPoint)
        {
            _log = VerboseTestLogging.GetInstance();
            _totalBytesRead = 0;
            _numConnectedSockets = 0;
            _maxNumConnections = numConnections;
            _receiveBufferSize = receiveBufferSize;

            // Allocate buffers such that the maximum number of sockets can have one outstanding read and  
            // write posted to the socket simultaneously.
            _bufferManager = new BufferManager(receiveBufferSize * numConnections * OpsToPreAlloc,
                receiveBufferSize);

            _readWritePool = new SocketAsyncEventArgsPool(numConnections);
            _maxNumberAcceptedClientsSemaphore = new Semaphore(numConnections, numConnections);
            Init();
            Start(localEndPoint);
        }