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 can I change the gateway and DNS
Forum Updated to NodeBB v4.3 + New Features

How can I change the gateway and DNS

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 933 Views
  • 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.
  • MihanM Offline
    MihanM Offline
    Mihan
    wrote on last edited by
    #1

    I search for something about network setting of QT on internet. I just found QNetworkInterface that it could change ip ,netmask and broadcast but without gateway and the DNS. So does it have other API to change that?

    1 Reply Last reply
    0
    • KillerSmathK Offline
      KillerSmathK Offline
      KillerSmath
      wrote on last edited by
      #2

      hi @Mihan.

      1. Can you provide us a better explanation of what is your issue ?
      2. Are you trying to set your system network settings or for another purpose ?

      @Computer Science Student - Brazil
      Web Developer and Researcher
      “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

      MihanM 1 Reply Last reply
      1
      • KillerSmathK KillerSmath

        hi @Mihan.

        1. Can you provide us a better explanation of what is your issue ?
        2. Are you trying to set your system network settings or for another purpose ?
        MihanM Offline
        MihanM Offline
        Mihan
        wrote on last edited by
        #3

        @KillerSmath Hi
        Yes I want to set the system network settings (linux). Is there no interface about set the network setting on Qt because of different API between WINDOWS and Linux?

        KillerSmathK 1 Reply Last reply
        0
        • MihanM Mihan

          @KillerSmath Hi
          Yes I want to set the system network settings (linux). Is there no interface about set the network setting on Qt because of different API between WINDOWS and Linux?

          KillerSmathK Offline
          KillerSmathK Offline
          KillerSmath
          wrote on last edited by
          #4

          @Mihan
          You could use QProcess to run system command lines from qt

          @Computer Science Student - Brazil
          Web Developer and Researcher
          “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

          MihanM 1 Reply Last reply
          1
          • KillerSmathK KillerSmath

            @Mihan
            You could use QProcess to run system command lines from qt

            MihanM Offline
            MihanM Offline
            Mihan
            wrote on last edited by
            #5

            @KillerSmath Yep I used QProcess("ifconfig ....") to set it. But when the machine restarted, the network settings would be restored to the old settings. I must save the latest settings and call this function again when restart. So ..... do you have any other better suggestions? Thank you.

            aha_1980A 1 Reply Last reply
            0
            • MihanM Mihan

              @KillerSmath Yep I used QProcess("ifconfig ....") to set it. But when the machine restarted, the network settings would be restored to the old settings. I must save the latest settings and call this function again when restart. So ..... do you have any other better suggestions? Thank you.

              aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Mihan Well ... probably this information is stored in a configuration file.

              You have to find out which config file is used by your O/S [*] and then probably you can make the changes directly there from your program.

              Regards

              *) Yeah there are really many possible locations for such a file, depending on the OS

              Qt has to stay free or it will die.

              MihanM 1 Reply Last reply
              0
              • aha_1980A aha_1980

                @Mihan Well ... probably this information is stored in a configuration file.

                You have to find out which config file is used by your O/S [*] and then probably you can make the changes directly there from your program.

                Regards

                *) Yeah there are really many possible locations for such a file, depending on the OS

                MihanM Offline
                MihanM Offline
                Mihan
                wrote on last edited by
                #7

                @aha_1980 Ok,thank you for your suggestions. Have a nice day~XD

                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