private void RunLoop() { Uv = new Libuv(); Log = new KestrelTrace(new LoggerFactory().CreateLogger <UvTcpListener>()); Loop = new UvLoopHandle(Log); Loop.Init(Uv); _shutdownPostHandle = new UvAsyncHandle(Log); _shutdownPostHandle.Init(Loop, OnPost, _queueCloseCallback); _listenSocket = new UvTcpHandle(Log); _listenSocket.Init(Loop, _queueCloseCallback); _listenSocket.NoDelay(true); string host = null; if (_ip == IPAddress.Any) { host = "*"; } else if (_ip == IPAddress.Loopback) { host = "localhost"; } else { host = _ip.ToString(); } var url = $"http://{host}:{_port}"; var address = Microsoft.AspNetCore.Server.Kestrel.ServerAddress.FromUrl(url); _listenSocket.Bind(address); _listenSocket.Listen(10, _onConnectionCallback, this); Uv.run(Loop, 0); }