Skip to content

Instantly share code, notes, and snippets.

@LuisFcoOrtiz
Created April 16, 2018 12:57
Show Gist options
  • Save LuisFcoOrtiz/84837d2b6bf6e0f266b741621aff1bc7 to your computer and use it in GitHub Desktop.
Save LuisFcoOrtiz/84837d2b6bf6e0f266b741621aff1bc7 to your computer and use it in GitHub Desktop.
Get Mac Address QT Cpp (function) | Obtener dirección MAC QT cpp (función))
//#include <QNetworkInterface> en cabecera
QString ClientUdp::getMacAddress() {
foreach(QNetworkInterface netInterface, QNetworkInterface::allInterfaces()) {
// Devuelve solo la primera dirección MAC que no sea de loopback
if (!(netInterface.flags() & QNetworkInterface::IsLoopBack))
return netInterface.hardwareAddress();
qDebug() << "obteniendo dirección MAC";
}
return QString();
}//funcion para obtener la direccion MAC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment