Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 C++ 应用程序必须查找指向 IPv6 地址的 DNS SRV 记录。从我目前的研究来看, res_search() 系列函数是要走的路。
有没有人有一个例子如何准备这样的查询以及如何提取 IPv6 结果?
res_search()(或req_query)可能是获取初始SRV记录的方法。
res_search()
req_query
SRV
但是,该SRV记录只能包含一个主机名,而不是文字 IPv6 地址。
您应该将该记录的主机名内容提供给该getaddrinfo()函数,然后该函数可以同时查找 IPv4 和 IPv6 地址。
getaddrinfo()