private UvTcpHandle ListenTcp(bool useFileHandle) { var socket = new UvTcpHandle(Log); try { socket.Init(Thread.Loop, Thread.QueueCloseHandle); #pragma warning disable CS0618 socket.NoDelay(TransportContext.Options.NoDelay); #pragma warning restore CS0618 if (!useFileHandle) { socket.Bind((IPEndPoint)EndPoint); // If requested port was "0", replace with assigned dynamic port. EndPoint = socket.GetSockIPEndPoint(); } else { socket.Open((IntPtr)((FileHandleEndPoint)EndPoint).FileHandle); } } catch { socket.Dispose(); throw; } return(socket); }
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); }