public TcpServer(IPEndPoint endpoint, SocketServerSettings settings, IHandler <TContext> application, IWorkLoadThrottle connectionThrottle) : base(endpoint, new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp), settings, connectionThrottle) { m_activeSockets = new SocketTable(); m_forcedAsyncCallback = new WaitCallback(this.ForcedAsyncComplete); m_contextPool = new SynchronizedObjectPool <TContext>(this.Settings.MaxActiveRequests); m_completeHandler = new EventHandler <SocketAsyncEventArgs>(this.AcceptConnection); m_handler = application; }
public SocketServerSettings AsSocketServerSettings() { SocketServerSettings settings = new SocketServerSettings(); settings.MaxOutstandingAccepts = this.MaxOutstandingAccepts; settings.MaxConnectionBacklog = this.MaxConnectionBacklog; settings.MaxActiveRequests = this.MaxActiveRequests; settings.ReadBufferSize = this.ReadBufferSize; settings.SendTimeout = this.SendTimeout; settings.ReceiveTimeout = this.ReceiveTimeout; settings.SocketCloseTimeout = this.SocketCloseTimeout; return settings; }
public DnsUdpServer(IPEndPoint endpoint, SocketServerSettings settings, IHandler<DnsUdpContext> requestHandler, IWorkLoadThrottle workThrottle) : base(endpoint, new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp), settings, workThrottle) { if (requestHandler == null) { throw new ArgumentNullException(); } m_requestHandler = requestHandler; m_receiveCompleteHandler = new EventHandler<SocketAsyncEventArgs>(this.ReceiveCompleted); m_fromAny = new IPEndPoint(IPAddress.Any, 0); m_contextPool = new SynchronizedObjectPool<DnsUdpContext>(this.Settings.MaxActiveRequests); }
public DnsUdpServer(IPEndPoint endpoint, SocketServerSettings settings, IHandler <DnsUdpContext> requestHandler, IWorkLoadThrottle workThrottle) : base(endpoint, new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp), settings, workThrottle) { if (requestHandler == null) { throw new ArgumentNullException(); } m_requestHandler = requestHandler; m_receiveCompleteHandler = new EventHandler <SocketAsyncEventArgs>(this.ReceiveCompleted); m_fromAny = new IPEndPoint(IPAddress.Any, 0); m_contextPool = new SynchronizedObjectPool <DnsUdpContext>(this.Settings.MaxActiveRequests); }
public SocketServerSettings AsSocketServerSettings() { SocketServerSettings settings = new SocketServerSettings(); settings.MaxOutstandingAccepts = this.MaxOutstandingAccepts; settings.MaxConnectionBacklog = this.MaxConnectionBacklog; settings.MaxActiveRequests = this.MaxActiveRequests; settings.ReadBufferSize = this.ReadBufferSize; settings.SendTimeout = this.SendTimeout; settings.ReceiveTimeout = this.ReceiveTimeout; settings.SocketCloseTimeout = this.SocketCloseTimeout; return(settings); }
public SocketServer(IPEndPoint endpoint, Socket listenSocket, SocketServerSettings settings, IWorkLoadThrottle workThrottle) { if (endpoint == null || listenSocket == null || settings == null) { throw new ArgumentNullException(); } settings.Validate(); m_settings = settings; m_endpoint = endpoint; m_socket = listenSocket; m_workThrottle = workThrottle ?? settings.CreateRequestThrottle(); m_outstandingAcceptThrottle = settings.CreateAcceptThrottle(); m_asyncArgsPool = new SynchronizedObjectPool <SocketAsyncEventArgs>(m_settings.MaxOutstandingAccepts); m_forcedAsyncCallback = new WaitCallback(this.ForcedAsyncComplete); m_listenerThread = new Thread(this.Run); }
public DnsUdpServer(IPEndPoint endpoint, SocketServerSettings settings, IHandler<DnsUdpContext> requestHandler) : this(endpoint, settings, requestHandler, null) { }
public DnsUdpServer(IPEndPoint endpoint, SocketServerSettings settings, IHandler <DnsUdpContext> requestHandler) : this(endpoint, settings, requestHandler, null) { }
public TcpServer(IPEndPoint endpoint, SocketServerSettings settings, IHandler <TContext> application) : this(endpoint, settings, application, null) { }
public SocketServer(IPEndPoint endpoint, Socket socket, SocketServerSettings settings) : this(endpoint, socket, settings, null) { }