static void Bind(TcpListener listener, string ipAddress, int port, bool ip6 = false, bool dualstack = false) { if (ip6) { sockaddr_in6 address = CreateSockaddrIp6(ipAddress.ToString(), port); UVException.ThrowIfError(UVInterop.uv_tcp_bind(listener.Handle, ref address, (uint)(dualstack ? 0 : 1))); } else { sockaddr_in address = CreateSockaddr(ipAddress.ToString(), port); UVException.ThrowIfError(UVInterop.uv_tcp_bind(listener.Handle, ref address, 0)); } }
internal static extern int uv_tcp_bind(IntPtr handle, ref sockaddr_in6 sockaddr, uint flags);
internal extern static int uv_ip6_addr(string ip, int port, out sockaddr_in6 address);