Beispiel #1
0
        public TcpSocketSaeaServer(IPEndPoint listenedEndPoint, ITcpSocketSaeaServerMessageDispatcher dispatcher, TcpSocketSaeaServerConfiguration configuration = null)
        {
            if (listenedEndPoint == null)
            {
                throw new ArgumentNullException("listenedEndPoint");
            }
            if (dispatcher == null)
            {
                throw new ArgumentNullException("dispatcher");
            }

            this.ListenedEndPoint = listenedEndPoint;
            _dispatcher           = dispatcher;
            _configuration        = configuration ?? new TcpSocketSaeaServerConfiguration();

            if (_configuration.BufferManager == null)
            {
                throw new InvalidProgramException("The buffer manager in configuration cannot be null.");
            }
            if (_configuration.FrameBuilder == null)
            {
                throw new InvalidProgramException("The frame handler in configuration cannot be null.");
            }

            Initialize();
        }
Beispiel #2
0
        public TcpSocketSaeaSession(
            TcpSocketSaeaServerConfiguration configuration,
            IBufferManager bufferManager,
            SaeaPool saeaPool,
            ITcpSocketSaeaServerMessageDispatcher dispatcher,
            TcpSocketSaeaServer server)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");
            if (bufferManager == null)
                throw new ArgumentNullException("bufferManager");
            if (saeaPool == null)
                throw new ArgumentNullException("saeaPool");
            if (dispatcher == null)
                throw new ArgumentNullException("dispatcher");
            if (server == null)
                throw new ArgumentNullException("server");

            _configuration = configuration;
            _bufferManager = bufferManager;
            _saeaPool = saeaPool;
            _dispatcher = dispatcher;
            _server = server;

            _receiveBuffer = _bufferManager.BorrowBuffer();
            _receiveBufferOffset = 0;
        }
Beispiel #3
0
        public TcpSocketSaeaServer(IPEndPoint listenedEndPoint, ITcpSocketSaeaServerMessageDispatcher dispatcher, TcpSocketSaeaServerConfiguration configuration = null)
        {
            if (listenedEndPoint == null)
                throw new ArgumentNullException("listenedEndPoint");
            if (dispatcher == null)
                throw new ArgumentNullException("dispatcher");

            this.ListenedEndPoint = listenedEndPoint;
            _dispatcher = dispatcher;
            _configuration = configuration ?? new TcpSocketSaeaServerConfiguration();

            if (_configuration.FrameBuilder == null)
                throw new InvalidProgramException("The frame handler in configuration cannot be null.");

            Initialize();
        }
        public TcpSocketSaeaSession(
            TcpSocketSaeaServerConfiguration configuration,
            ISegmentBufferManager bufferManager,
            SaeaPool saeaPool,
            ITcpSocketSaeaServerMessageDispatcher dispatcher,
            TcpSocketSaeaServer server)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (bufferManager == null)
            {
                throw new ArgumentNullException("bufferManager");
            }
            if (saeaPool == null)
            {
                throw new ArgumentNullException("saeaPool");
            }
            if (dispatcher == null)
            {
                throw new ArgumentNullException("dispatcher");
            }
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

            _configuration = configuration;
            _bufferManager = bufferManager;
            _saeaPool      = saeaPool;
            _dispatcher    = dispatcher;
            _server        = server;

            if (_receiveBuffer == default(ArraySegment <byte>))
            {
                _receiveBuffer = _bufferManager.BorrowBuffer();
            }
            _receiveBufferOffset = 0;
        }
        public TcpSocketSaeaSession(
            TcpSocketSaeaServerConfiguration configuration,
            IBufferManager bufferManager,
            SaeaPool saeaPool,
            ITcpSocketSaeaServerMessageDispatcher dispatcher,
            TcpSocketSaeaServer server)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (bufferManager == null)
            {
                throw new ArgumentNullException("bufferManager");
            }
            if (saeaPool == null)
            {
                throw new ArgumentNullException("saeaPool");
            }
            if (dispatcher == null)
            {
                throw new ArgumentNullException("dispatcher");
            }
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

            _configuration = configuration;
            _bufferManager = bufferManager;
            _saeaPool      = saeaPool;
            _dispatcher    = dispatcher;
            _server        = server;

            _receiveBuffer      = _bufferManager.BorrowBuffer();
            _sessionBuffer      = _bufferManager.BorrowBuffer();
            _sessionBufferCount = 0;
        }
Beispiel #6
0
 public TcpSocketSaeaServer(IPAddress listenedAddress, int listenedPort, ITcpSocketSaeaServerMessageDispatcher dispatcher, TcpSocketSaeaServerConfiguration configuration = null)
     : this(new IPEndPoint(listenedAddress, listenedPort), dispatcher, configuration)
 {
 }
Beispiel #7
0
 public TcpSocketSaeaServer(int listenedPort, ITcpSocketSaeaServerMessageDispatcher dispatcher, TcpSocketSaeaServerConfiguration configuration = null)
     : this(IPAddress.Any, listenedPort, dispatcher, configuration)
 {
 }
Beispiel #8
0
 public TcpSocketSaeaServer(IPAddress listenedAddress, int listenedPort, ITcpSocketSaeaServerMessageDispatcher dispatcher, TcpSocketSaeaServerConfiguration configuration = null)
     : this(new IPEndPoint(listenedAddress, listenedPort), dispatcher, configuration)
 {
 }
Beispiel #9
0
 public TcpSocketSaeaServer(int listenedPort, ITcpSocketSaeaServerMessageDispatcher dispatcher, TcpSocketSaeaServerConfiguration configuration = null)
     : this(IPAddress.Any, listenedPort, dispatcher, configuration)
 {
 }