In a network application written in Qt, if you want to get all IP addresses on the host machine, you can use QNetworkInterface::allAddresses(). But please bear in mind that this function only returns the addresses of interfaces whose link are UP, as stated in Qt Docs:

This convenience function returns all IP addresses found on the host machine. It is equivalent to calling addressEntries() on all the objects returned by allInterfaces() that are in the QNetworkInterface::IsUp state to obtain lists of QNetworkAddressEntry objects then calling QNetworkAddressEntry::ip() on each of these.

So based on this description, if you want to get…

Philip Ye


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store