Some trouble with QNetworkAccessManager and wifi on Windows 7



  • 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


  • Lifetime Qt Champion

    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.



  • 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


  • Lifetime Qt Champion

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



  • 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


  • Lifetime Qt Champion

    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/



  • 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


  • Lifetime Qt Champion

    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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.