Пример #1
0
        private UvTcpHandle ListenTcp(bool useFileHandle)
        {
            var socket = new UvTcpHandle(Log);

            try
            {
                socket.Init(Thread.Loop, Thread.QueueCloseHandle);
                socket.NoDelay(EndPointInformation.NoDelay);

                if (!useFileHandle)
                {
                    socket.Bind(EndPointInformation.IPEndPoint);

                    // If requested port was "0", replace with assigned dynamic port.
                    EndPointInformation.IPEndPoint = socket.GetSockIPEndPoint();
                }
                else
                {
                    socket.Open((IntPtr)EndPointInformation.FileHandle);
                }
            }
            catch
            {
                socket.Dispose();
                throw;
            }

            return(socket);
        }
Пример #2
0
        private UvTcpHandle CreateAcceptSocket()
        {
            var socket = new UvTcpHandle(Log);

            try
            {
                socket.Init(_thread.Loop, _thread.QueueCloseHandle);
                socket.NoDelay(true);
            }
            catch
            {
                socket.Dispose();
                throw;
            }

            return(socket);
        }
Пример #3
0
        private UvTcpHandle AcceptTcp()
        {
            var socket = new UvTcpHandle(Log);

            try
            {
                socket.Init(Thread.Loop, Thread.QueueCloseHandle);
                socket.NoDelay(EndPointInformation.NoDelay);
            }
            catch
            {
                socket.Dispose();
                throw;
            }

            return(socket);
        }