Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to get primary and secondary DNS servers in Qt?

How to get primary and secondary DNS servers in Qt?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 2.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    brick
    wrote on last edited by
    #1

    I have configured on a Windows machine primary DNS server = 8.8.8.8 and secondary DNS server = 8.8.4.4. How can I find these addresses using Qt?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply
      1
      • SGaistS SGaist

        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.

        B Offline
        B Offline
        brick
        wrote on last edited by
        #3

        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 8.8.8.8) 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.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then indeed it's outside of Qt's scope.

          You may want to take a look at this stackoverflow post for platform specific solutions.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved