How can I use libcurl function “curl_easy_setopt(CURL *handle, CURLOPT_DNS_LOCAL_IP4, char *address);”

陌路散爱 提交于 2019-12-11 03:31:53

问题


I want to use function curl_easy_setopt(CURL *handle, CURLOPT_DNS_LOCAL_IP4, char *address), but when I download the source code,

./configure && make && make install

every fucntion is OK but this function curl_easy_setopt(CURL *handle, CURLOPT_DNS_LOCAL_IP4, char *address). This function explanation http://curl.haxx.se/libcurl/c/CURLOPT_DNS_LOCAL_IP4.html.AVAILABILITY says this option requires that libcurl was built with a resolver backend that supports this operation. The c-ares backend is the only such one. what does it mean? how I build libcurl with a resoluver backend.

thank you


回答1:


It means that you need to make sure that you build your libcurl to use c-ares for name resolving. This is because "normal" name resolver functions can't be told which servers to use (nor which source address to use when doing that communication), they use the ones you set in the system files.

c-ares is a separate library that does asynchronous DNS and name resolver calls that libcurl can be told to use.



来源:https://stackoverflow.com/questions/29738520/how-can-i-use-libcurl-function-curl-easy-setoptcurl-handle-curlopt-dns-local

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!