Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Solved Some trouble with QNetworkAccessManager and wifi on Windows 7

    General and Desktop
    qt5.9 qtnetwork windows 7
    2
    8
    2361
    Loading More Posts
    • 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.
    • N
      nelbok last edited by

      Hello,

      I am using Qt 5.9.5 on Windows 7.

      When I want to check the network, QNetworkAccessManager::networkAccessible() return NotAccessible...
      When I use my internet browser, I have no problem to navigate on Internet.

      Its works fine on Windows 10 and macOS. What I am missing to have this work on Windows 7?

      Regards,

      nelbok

      1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by

        Hi
        You might have more than one interface so maybe you are asking the wrong one?
        You can list the ones it knows
        http://doc.qt.io/qt-5/qnetworkconfigurationmanager.html#allConfigurations
        and see what is going on.

        1 Reply Last reply Reply Quote 2
        • N
          nelbok last edited by

          Hello,

          I have checked the active configuration and configuration on Windows7. Both doesn't get a valid configuration.

          When I check the QNetworkConfiguration::allConfiguration, I can see 2 connections :

          • Ethernet connection not pluged
          • WiFi connection with QNetworkConfiguration::bearerTypeName equals Unknown

          So maybe QNetworkAccessManager::configuration didn't get a configuration from QNetworkConfigurationManager?

          Regards,

          nelbok

          mrjj 1 Reply Last reply Reply Quote 0
          • mrjj
            mrjj Lifetime Qt Champion @nelbok last edited by

            Hi
            That is a bit odd.
            Same code just works on win 10 ?

            1 Reply Last reply Reply Quote 0
            • N
              nelbok last edited by

              Hello,

              Yes, same code works on Windows 10.

              But when checked on them, they didn't found the wifi and have differents configurations:

              • Teredo Tunneling Pseudo-Interface
              • Virtual Ethernet like Hyper-V
              • Some other interface with Internet possibility

              I think it is not the best way to test if there are a possible internet connection...

              Regards,

              nelbok

              1 Reply Last reply Reply Quote 0
              • mrjj
                mrjj Lifetime Qt Champion last edited by

                Hi
                If only to check for internet then i agree :)
                Its much easier just to try to use it as it will then use the default interface like
                all other apps.
                http://amin-ahmadi.com/2016/04/05/check-internet-connection-availability-status-qt/

                1 Reply Last reply Reply Quote 1
                • N
                  nelbok last edited by nelbok

                  Hello,

                  After some tests. It doesn't work on Qt 5.10 and Qt 5.11.

                  I have also tested with Qt 5.6.3 and I can see the WiFi connection.
                  But, when I cut my WiFi, Its keep the connection...

                  I think there are some trouble, I will fill a report to see if it is possible to improve this.

                  For your link, yes, it works as long that we can ping the server and the server is not offline or blocked.

                  I can always use https://msdn.microsoft.com/en-US/library/windows/desktop/aa384702(v=vs.85).aspx to know if we are connected.
                  Now I need to create a class that can send a signal when the connection change.

                  Regards,

                  nelbok

                  1 Reply Last reply Reply Quote 0
                  • mrjj
                    mrjj Lifetime Qt Champion last edited by

                    Ok, it sounds like a bug then.
                    Good if you open ticket.
                    Make sure to include a small complete working example they can use
                    to reproduce it.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post