How to get primary and secondary DNS servers in Qt?
I have configured on a Windows machine primary DNS server = 22.214.171.124 and secondary DNS server = 126.96.36.199. How can I find these addresses using Qt?
Hi and welcome to devnet,
Out of curiosity, why do you need that information ?
If you would like to query them, there’s the QDnsLookup class.
Hi, @SGaist, thanks for replying. I need to find out the IP address of the primary DNS server to pass it to another module that requires it (pjsip). I can't use public DNS servers (like 188.8.131.52) because some organizations that use the software I'm working on blocks external DNS servers. So I need to find the primary DNS server configured on the machine.
I took a look at QDnsLookup class before and it didn't help me. I imagine the only solution is to use QProcess to invoke nslookup and then parse the resulting string.
Then indeed it's outside of Qt's scope.
You may want to take a look at this stackoverflow post for platform specific solutions.