示例#1
0
        /// <summary>
        /// Creates a socket which can be used to accept an incoming connection
        /// </summary>
        protected override UvStreamHandle CreateAcceptSocket()
        {
            var acceptSocket = new UvTcpHandle();

            acceptSocket.Init(Thread.Loop, Thread.QueueCloseHandle);
            acceptSocket.NoDelay(true);
            acceptSocket.KeepAlive(true);
            return(acceptSocket);
        }
示例#2
0
        /// <summary>
        /// Handle an incoming connection
        /// </summary>
        /// <param name="listenSocket">Socket being used to listen on</param>
        /// <param name="status">Connection status</param>
        protected override void OnConnection(UvStreamHandle listenSocket, int status)
        {
            var acceptSocket = new UvTcpHandle();

            try
            {
                acceptSocket.Init(Thread.Loop, Thread.QueueCloseHandle);
                acceptSocket.NoDelay(true);
                acceptSocket.KeepAlive(true);
                listenSocket.Accept(acceptSocket);
                DispatchConnection(acceptSocket);
            }
            catch (UvException)
            {
                //Service.Logger.Log(ex);
                acceptSocket.Dispose();
                return;
            }
        }
示例#3
0
 public void KeepAlive(uint delay)
 {
     UvTcpHandle.KeepAlive(delay);
 }