public TcpSocketSaeaServer(IPEndPoint listenedEndPoint, ITcpSocketSaeaServerEventDispatcher 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(); }
public TcpSocketSaeaServer( IPAddress listenedAddress, int listenedPort, Func <TcpSocketSaeaSession, byte[], int, int, Task> onSessionDataReceived = null, Func <TcpSocketSaeaSession, Task> onSessionStarted = null, Func <TcpSocketSaeaSession, Task> onSessionClosed = null, TcpSocketSaeaServerConfiguration configuration = null) : this(new IPEndPoint(listenedAddress, listenedPort), onSessionDataReceived, onSessionStarted, onSessionClosed, configuration) { }
public TcpSocketSaeaServer( IPEndPoint listenedEndPoint, Func <TcpSocketSaeaSession, byte[], int, int, Task> onSessionDataReceived = null, Func <TcpSocketSaeaSession, Task> onSessionStarted = null, Func <TcpSocketSaeaSession, Task> onSessionClosed = null, TcpSocketSaeaServerConfiguration configuration = null) : this(listenedEndPoint, new DefaultTcpSocketSaeaServerEventDispatcher(onSessionDataReceived, onSessionStarted, onSessionClosed), configuration) { }
public TcpSocketSaeaSession( TcpSocketSaeaServerConfiguration configuration, ISegmentBufferManager bufferManager, SaeaPool saeaPool, ITcpSocketSaeaServerEventDispatcher 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 TcpSocketSaeaServer(IPAddress listenedAddress, int listenedPort, ITcpSocketSaeaServerEventDispatcher dispatcher, TcpSocketSaeaServerConfiguration configuration = null) : this(new IPEndPoint(listenedAddress, listenedPort), dispatcher, configuration) { }
public TcpSocketSaeaServer(int listenedPort, ITcpSocketSaeaServerEventDispatcher dispatcher, TcpSocketSaeaServerConfiguration configuration = null) : this(IPAddress.Any, listenedPort, dispatcher, configuration) { }