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. Hidden magic in QNetworkInterface::allInterfaces()?

Hidden magic in QNetworkInterface::allInterfaces()?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 983 Views 1 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
    bovilexic
    wrote on last edited by
    #1

    On Windows: when my code (in a Qt console test app) calls

    @QList<QNetworkInterface> list = QNetworkInterface::allInterfaces();@

    the first entry I get is always the one for the ethernet cable adapter. This is true, even if I explicitly disable that one in the relevant control panel. This is a good thing.

    I see, in the Qt code, that ultimately the Windows function GetAdaptersInfo() is called to get the list of adapters.

    However, in another app (where I'm unable to use this Qt call, due to linking issues...), I get a list of adapters using that very same GetAdaptersInfo() function. However, in this context, when the ethernet cable adapter is disabled with the control panel, I do not see an entry for that adapter in the list I get back. Various searches on the web indicate that a disabled adapter will not appear in the list given by GetAdaptersInfo().

    Frankly, I'm stumped: my own non-Qt code doesn't give me disabled adapters, and this is consistent with the info on the web. But, looking at the results from my little Qt console program, I'm indeed seeing that disabled adapter.

    How can this be?

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

      Hi,

      Just a guess but it might be using a cache after the first call

      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
      0
      • B Offline
        B Offline
        bovilexic
        wrote on last edited by
        #3

        That would make sense...

        1 Reply Last reply
        0

        • Login

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