PDA

View Full Version : Problem in feteching mac address.



Niamita
22nd November 2012, 12:33
Hi all

I am feteching mac address it is coming right on pc but when i run it on devices it is not correct address.
I am using this code


bool result = false;
for (int i = 0; i < ifaces.count(); i++)
{
QNetworkInterface iface = ifaces.at(i);
if ( iface.flags().testFlag(QNetworkInterface::IsUp) && !iface.flags().testFlag(QNetworkInterface::IsLoopB ack) )
{
qDebug() << "name:" << iface.name() << endl << "ip addresses:" << endl<< "mac:" << iface.hardwareAddress() << endl;
for (int j=0; j<iface.addressEntries().count(); j++)
{
qDebug() << iface.addressEntries().at(j).ip().toString()<< " / " << iface.addressEntries().at(j).netmask().toString() << endl;
if (result == false)
result = true;
}
}
}
Like if devices's mac address is "74:45:8A:5D:15:B9" and "00:19:07:43:c6:55" then it is coming "01:00:74:45:8A:5D" and "01:00:00:19:07:43" respectively. Thank You.