Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to get LAN ip Address
prankur.sarbhai last edited by
I am using the following code to get the ip address
foreach (const QHostAddress &address, QNetworkInterface::allAddresses())
if (address.protocol() == QAbstractSocket::IPv4Protocol && address != QHostAddress(QHostAddress::LocalHost))
qDebug() << address.toString();
IpAddr = address.toString();
I am connected with lan and Wlan both , so it displays 2 address. Can you please let me know how to distinguish between LAn and Wlan?
[[marked up code, Tobias]]
You can not do that based on the IP address.