新增网页效果图
This commit is contained in:
@@ -31,31 +31,7 @@ void frmUdpServer::initForm()
|
||||
void frmUdpServer::initIP()
|
||||
{
|
||||
//获取本机所有IP
|
||||
QStringList ips;
|
||||
QList<QNetworkInterface> netInterfaces = QNetworkInterface::allInterfaces();
|
||||
foreach(const QNetworkInterface &netInterface, netInterfaces) {
|
||||
//移除虚拟机和抓包工具的虚拟网卡
|
||||
QString humanReadableName = netInterface.humanReadableName().toLower();
|
||||
if(humanReadableName.startsWith("vmware network adapter") || humanReadableName.startsWith("npcap loopback adapter")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//过滤当前网络接口
|
||||
bool flag = (netInterface.flags() == (QNetworkInterface::IsUp | QNetworkInterface::IsRunning | QNetworkInterface::CanBroadcast | QNetworkInterface::CanMulticast));
|
||||
if(flag) {
|
||||
QList<QNetworkAddressEntry> addrs = netInterface.addressEntries();
|
||||
foreach(QNetworkAddressEntry addr, addrs) {
|
||||
//只取出IPV4的地址
|
||||
if(addr.ip().protocol() == QAbstractSocket::IPv4Protocol) {
|
||||
QString ip4 = addr.ip().toString();
|
||||
if(ip4 != "127.0.0.1") {
|
||||
ips.append(ip4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QStringList ips = QUIHelper::getLocalIPs();
|
||||
ui->cboxListenIP->addItems(ips);
|
||||
ui->cboxListenIP->addItem("127.0.0.1");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user