我正在寻找一个以IPv6地址为参数并返回域名的函数。
举个例子,2a00:1450:8006::68返回ipv6.google.com。
(目的是将该域名提供给getaddrinfo函数。)
谢谢 :-)
编辑1:我尝试了getaddrinfo("2a00:1450:8006::68", "http", NULL, &result);
,它返回"address family for hostname not supported",而getaddrinfo("ipv6.google.com", "http", NULL, &result);
返回"no address is associated with hotname"错误。
编辑2:我同意你的观点,我在IPV6系统上遇到了问题,我尝试了http://test-ipv6.com/,结果显示我没有IPV6地址,但使用ifconfig
命令返回:
adr inet6: fe80::15b:fcff:fe65:d516/64 Scope:Lien
getaddrinfo
呢? - undefined