public AsyncTcpSocketSession( TcpClient tcpClient, AsyncTcpSocketServerConfiguration configuration, ISegmentBufferManager bufferManager, IAsyncTcpSocketServerEventDispatcher dispatcher, AsyncTcpSocketServer server) { if (tcpClient == null) { throw new ArgumentNullException("tcpClient"); } if (configuration == null) { throw new ArgumentNullException("configuration"); } if (bufferManager == null) { throw new ArgumentNullException("bufferManager"); } if (dispatcher == null) { throw new ArgumentNullException("dispatcher"); } if (server == null) { throw new ArgumentNullException("server"); } _tcpClient = tcpClient; _configuration = configuration; _bufferManager = bufferManager; _dispatcher = dispatcher; _server = server; _sessionKey = Guid.NewGuid().ToString(); this.StartTime = DateTime.UtcNow; SetSocketOptions(); _remoteEndPoint = this.RemoteEndPoint; _localEndPoint = this.LocalEndPoint; }
public AsyncTcpSocketServer(IPEndPoint listenedEndPoint, IAsyncTcpSocketServerEventDispatcher dispatcher, AsyncTcpSocketServerConfiguration configuration = null) { if (listenedEndPoint == null) { throw new ArgumentNullException("listenedEndPoint"); } if (dispatcher == null) { throw new ArgumentNullException("dispatcher"); } this.ListenedEndPoint = listenedEndPoint; _dispatcher = dispatcher; _configuration = configuration ?? new AsyncTcpSocketServerConfiguration(); 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."); } }
public AsyncTcpSocketServer(IPAddress listenedAddress, int listenedPort, IAsyncTcpSocketServerEventDispatcher dispatcher, AsyncTcpSocketServerConfiguration configuration = null) : this(new IPEndPoint(listenedAddress, listenedPort), dispatcher, configuration) { }
public AsyncTcpSocketServer(int listenedPort, IAsyncTcpSocketServerEventDispatcher dispatcher, AsyncTcpSocketServerConfiguration configuration = null) : this(IPAddress.Any, listenedPort, dispatcher, configuration) { }