Using QHostInfo to get host name from an IP
I am trying to get the host name from a IP inside my LAN using QHostInfo.
This is my code:
@bool rede::verificaIP(QString ip)
QHostInfo info = QHostInfo::fromName(ip);
qDebug() << "IP:" << info.hostName() << info.addresses(); return false;
The ip parameter is 192.168.1.91
But the result is:
IP: "192.168.1.91" (QHostAddress("192.168.1.91") )
The function does not returns the host name
Can anyone help me?
Thanks a lot.
you can try to see with wireshark what is the response to your reverse DNS query
Sorry, but how can I do that?
Hi and welcome to devnet,
Shouldn't you rather use "lookupHost":http://qt-project.org/doc/qt-5/qhostinfo.html#lookupHost ?
Are you sure that your ip resolve to an host name ?
On windows you can try ping -a 192.168.1.91
You are right, my network is not resolving names. Sorry about that.