我用下面这段代码获取本机的IP地址,但我应该怎样区分本地连接、无线连接、以及VMWare虚拟网卡等多个IP地址呢?
QString localHostName = QHostInfo::localHostName();
QHostInfo info = QHostInfo::fromName(localHostName);
foreach(QHostAddress address,info.addresses())
{
if(address.protocol() == QAbstractSocket::IPv4Protocol)
{
qDebug() <<"IPV4 Address: "<< address.toString();
}
}