コード例 #1
0
ファイル: KayakServer.cs プロジェクト: halvors/FourDeltaOne
        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()));
        }