简体   繁体   English

如何在Qt中获取主要和辅助DNS服务器?

[英]How to get primary and secondary DNS servers in Qt?

I have configured on a Windows machine primary DNS server = 8.8.8.8 and secondary DNS server = 8.8.4.4. 我已经在Windows计算机上配置了主DNS服务器= 8.8.8.8和辅助DNS服务器= 8.8.4.4。 How can I find these addresses using Qt? 如何使用Qt查找这些地址?

There is no Qt functionality to doing this. 没有Qt功能可以执行此操作。 You need to use your OS specific API to do this. 您需要使用特定于操作系统的API来执行此操作。 For linux you can read /etc/resolv.conf file or do check IPs with sockets programming. 对于linux,您可以读取/etc/resolv.conf文件,或使用sockets编程检查IP。

On Windows you can use GetAdapterAdresses <- C++ example code included 在Windows上,您可以使用GetAdapterAdresses <-C ++示例代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM