To retrieve the Hostname from an IP address you can call lookupHost(), which takes the host name or IP address, a receiver object, and a slot signature as arguments. The slot is invoked when the results are ready. The results are stored in a QHostInfo object. Call addresses() to get the list of IP addresses for the host, and hostName() to get the host name that was looked up.
QHostInfo::lookupHost("92.168.1.1",
this, SLOT(lookedUp(QHostInfo)));
void MyWidget::lookedUp(const QHostInfo &host)
{
if (host.error() != QHostInfo::NoError) {
qDebug() << "Lookup failed:" << host.errorString();
return;
}
foreach (const QHostAddress &address, host.addresses())
qDebug() << "Found address:" << address.toString();
}
For obtaining the MAC address of a remote IP you should use system commands and platform-specific code. There is no way in Qt to do that. For example on Windows it can be done by:
arp -a <IP>