public IDisposable Listen(IPEndPoint ep) { if (ep == null) { throw new ArgumentNullException("ep"); } state.SetListening(); NPx.Log.Debug("KayakServer will bind to " + ep.ToString()); listener.Bind(ep); listener.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 10000); listener.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 10000); listener.Listen((int)SocketOptionName.MaxConnections); NPx.Log.Debug("KayakServer bound to " + ep.ToString()); AcceptNext(); return(new Disposable(() => Close())); }