Reputation: 142
I get information about All network adapter installed on my computer with function GetNetworkParam, GetInterfaceInfo and etc...
now in C++, I want get information physical network adapter in my system not all adapter(not VMWare, and etc), just physical, how do it?
Upvotes: 0
Views: 892
Reputation: 9648
As Sam V. Pointed out, C++ is a language that knows nothing about network hardware. However there are many ways in which you can find that information, usually by using some libraries or frameworks. It depends however on some of your requirements. For example, finding a completely portable solution is probably going to be hard.
That said, I would use Qt for this, as it is portable over many popular platforms while still containing an impressive list of features. Check out the following from the official documentation:
Some example code I use to filter interfaces in my application:
QList<QNetworkInterface> interfaceList=QNetworkInterface::allInterfaces();
for(QNetworkInterface iface:interfaceList){
QNetworkInterface::InterfaceFlags flags=iface.flags();
if(flags&QNetworkInterface::InterfaceFlag::IsLoopBack){
continue;
}
if(flags&QNetworkInterface::InterfaceFlag::IsPointToPoint){
continue;
}
// Filter on other properties you want here
}
Upvotes: 1