Win32 getaddrinfo() 不使用 C:\Windows\System32\drivers tc\hosts?

问题描述 投票:0回答:1

Win32

getaddrinfo()
使用
C:\Windows\System32\drivers\etc\hosts
吗?

我们想使用

C:\Windows\System32\drivers\etc\hosts
指定仅 IPv6 地址(不属于 DNS 的一部分),并让我们的 Win32 控制台应用程序通过
getaddrinfo()
使用它,但它找不到它。

为什么?是否有一个使用

C:\Windows\System32\drivers\etc\hosts
AND DNS 的 API?

winapi dns winsock winsock2
1个回答
0
投票

没有。

C:\Windows\System32\drivers\etc\hosts
是一个DNS文件,可以直接用记事本打开,重定向IP地址。

    The format is: IP address - space - domain name
    It can redirect a domain name to an IP.

Win32 getaddrinfo() 使用 C:\Windows\System32\drivers tc\hosts 吗?

getaddrinfo
函数提供从 ANSI 主机名到地址的独立于协议的转换。

如果你想指定仅IPv6地址,可以看我的回答 如何显示当前的IPv6连接?

© www.soinside.com 2019 - 2024. All rights reserved.