Пример #1
0
        public Server(int numConnections = 1000, int receiveBufferSize = 4096)
        {
            this.m_numConnectedSockets = 0;
            this.m_numConnections      = numConnections;
            this.m_receiveBufferSize   = receiveBufferSize;

            asyncpool = new SocketAsyncEventArgsPool(numConnections, (t) =>
            {
                t.Completed += new EventHandler <SocketAsyncEventArgs>(Connection.IO_Completed);
            });

            buffManager = new BufferManager(numConnections, receiveBufferSize);

            asyncpool_buffered = new SocketAsyncEventArgsPool(numConnections, (t) =>
            {
                t.Completed += new EventHandler <SocketAsyncEventArgs>(Connection.IO_Completed);
                buffManager.SetBuffer(t);
            });
        }