Skip to content
Snippets Groups Projects
Commit f35a57a8 authored by Juhász Bálint's avatar Juhász Bálint
Browse files

minden info az interfeszrol

parents
Branches
No related tags found
No related merge requests found
#include <QCoreApplication>
#include <QtNetwork/QNetworkInterface>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QList<QNetworkInterface> ifList = QNetworkInterface::allInterfaces(); // now you have interfaces list
foreach (QNetworkInterface iface, ifList) // this should print all interfaces' names
{
QTextStream(stdout) << iface.humanReadableName() << '\n';
QTextStream(stdout) << '\t' << "can broadcast? " << iface.CanBroadcast << '\n';
QTextStream(stdout) << '\t' << "can multicast? " << iface.CanMulticast << '\n';
QTextStream(stdout) << '\t' << "HW address: " << iface.hardwareAddress() << '\n';
QTextStream(stdout) << '\t' << "is loopback? " << iface.IsLoopBack << '\n';
QTextStream(stdout) << '\t' << "is point-to-point? " << iface.IsPointToPoint << '\n';
QTextStream(stdout) << '\t' << "is running? " << iface.IsRunning << '\n';
QTextStream(stdout) << '\t' << "is up? " << iface.IsUp << '\n';
QTextStream(stdout) << '\t' << "is valid? " << iface.isValid() << '\n';
QTextStream(stdout) << '\t' << "internal name: " << iface.name() << '\n';
}
return a.exec();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment