How do I force libcurl to access a server running in dual stack mode over either ipv4 or ipv6? It shouldn’t be hard to do using IPs addresses, but I’m looking for something that works with DNS …
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You bet. The config
CURLOPT_IPRESOLVEwhich can be set toCURL_IPRESOLVE_V4orCURL_IPRESOLVE_V6.A more robust solution, if you can control DNS in anyway, is to make an
Arecord for the v4 address and a separateAAAArecord for the v6 address. This would let you pick the network you want to poll this system by, regardless of DNS resolution. But CURL can do what you want, just fine.