Results 1 to 3 of 3

Thread: How to get list of physical network interfaces?

  1. #1
    Join Date
    Aug 2011
    Location
    India
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question How to get list of physical network interfaces?

    Hi, I'm trying to get the list of all real network interfaces in a computer. Both the active and inactive ones. This is the code I used:

    Qt Code:
    1. QList<QNetworkInterface> allInterfaces = QNetworkInterface::allInterfaces();
    2. foreach(QNetworkInterface iFace, allInterfaces) {
    3. qDebug() << iFace.humanReadableName();
    4. }
    To copy to clipboard, switch view to plain text mode 

    and this is what I get

    Qt Code:
    1. "Bluetooth Network Connection"
    2. "Wireless Network Connection"
    3. "Local Area Connection"
    4. "Local Area Connection* 9"
    5. "Local Area Connection* 6"
    6. "Local Area Connection* 7"
    7. "Local Area Connection-McAfee NDIS Light-Weight Filter-0000"
    8. "Local Area Connection-WFP LightWeight Filter-0000"
    9. "Local Area Connection* 8"
    10. "Local Area Connection-QoS Packet Scheduler-0000"
    11. "Local Area Connection* 6-McAfee NDIS Light-Weight Filter-0000"
    12. "Local Area Connection* 6-QoS Packet Scheduler-0000"
    13. "Local Area Connection* 8-McAfee NDIS Light-Weight Filter-0000"
    14. "Local Area Connection* 8-QoS Packet Scheduler-0000"
    15. "Local Area Connection* 7-McAfee NDIS Light-Weight Filter-0000"
    16. "Local Area Connection* 7-QoS Packet Scheduler-0000"
    17. "Local Area Connection* 5"
    18. "Local Area Connection* 10"
    19. "Loopback Pseudo-Interface 1"
    20. "Wireless Network Connection-Native WiFi Filter Driver-0000"
    21. "Wireless Network Connection-QoS Packet Scheduler-0000"
    22. "Wireless Network Connection-McAfee NDIS Light-Weight Filter-0000"
    23. "Wireless Network Connection-WFP LightWeight Filter-0000"
    24. "Local Area Connection*"
    25. "Local Area Connection* 2"
    26. "Local Area Connection* 3"
    27. "Local Area Connection* 4"
    28. "isatap.{1A7372EB-C154-48C7-A90C-5D20357D5682}"
    29. "isatap.{1A7372EB-C154-48C7-A90C-5D20357D5682}-McAfee NDIS Light-Weight Filter-0000"
    30. "Teredo Tunneling Pseudo-Interface"
    31. "Reusable ISATAP Interface {881DDFED-EB39-42CA-A446-F4B55E48C2A6}-McAfee NDIS Light-Weight Filter-0000"
    32. "isatap.Belkin-McAfee NDIS Light-Weight Filter-0000"
    33. "Local Area Connection* 11"
    34. "isatap.Belkin"
    35. "isatap.{DBFD5208-893B-4F36-859C-480E466384E0}-McAfee NDIS Light-Weight Filter-0000"
    36. "isatap.{DBFD5208-893B-4F36-859C-480E466384E0}"
    37. "Reusable ISATAP Interface {881DDFED-EB39-42CA-A446-F4B55E48C2A6}"
    38. "Local Area Connection* 11-McAfee NDIS Light-Weight Filter-0000"
    To copy to clipboard, switch view to plain text mode 

    I just need the first three as all the others are virtual connections. Filtering the list with network interface flags did not work as they only removed the inactive connections and all these virtual ones seem to be active.

    Does anyone have any suggestions? I need help!
    There are no stupid questions, but there are lots of inquisitive idiots.

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to get list of physical network interfaces?

    I don't think you can distinguish between real and virtual adapters without using platform specific api.

  3. #3
    Join Date
    Aug 2011
    Location
    India
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to get list of physical network interfaces?

    But that means I have to write different code for each platform. Oh, well.. thanks for the info.
    There are no stupid questions, but there are lots of inquisitive idiots.

Similar Threads

  1. QUdpSocket - Multiple Network Interfaces
    By dbrmik in forum Qt Programming
    Replies: 0
    Last Post: 24th April 2009, 13:47
  2. Replies: 12
    Last Post: 22nd March 2009, 11:22
  3. Replies: 0
    Last Post: 18th March 2009, 06:33
  4. system network adapter list
    By rakesh in forum Qt Programming
    Replies: 0
    Last Post: 17th March 2009, 13:02
  5. network adapter list display
    By rakesh in forum Qt Tools
    Replies: 0
    Last Post: 17th March 2009, 12:16

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.