get computer wireless LAN adapter IP address
Solved
General and Desktop
-
Hi all,
I'm using the next code to extract my computer IP address (using QHostInfo class):
QString localhostname = QHostInfo::localHostName();
QString localhostIP;
QList<QHostAddress> hostList = QHostInfo::fromName(localhostname).addresses();
foreach (const QHostAddress& address, hostList) {
if (address.protocol() == QAbstractSocket::IPv4Protocol && address.isLoopback() == false) {
localhostIP = address.toString();
}
}
My problem is that my computer also got Ethernet adapter connected to the network, and the code return the adapter IP. there is a way to distinguish between the wireless adapter IP to the Ethernet adapter IP ? (both are IP4 with private IP numbers 10.0.0.x).
Thanks (: