Can't resolve hostname from ip adress QHostInfo::fromName(IP)
-
Hello everyone,
I try to make a really simple program who return the host name on a network from it ip address.
Unfortunately every ip I tried return only the ip.here is the code :
QHostInfo HI = QHostInfo::fromName("192.168.1.122"); // this PC hostname is "deian8-trb"
qDebug() << HI.hostName(); // display "192.168.2.122"I try with lookupHost but the result are the same.
Did someone have an idea of the problem ?
-
Did you try localHostName?
-
Hi,
From your description it looks like you should be using lookupHost.
-
Do you have an upToDate host file on your computer ?
On Windows 7%systemroot%\system32\drivers\etc\host
Or On Linux Systems
/etc/hosts
If not, i think that's the DNS in charge of name resolution. So the DNS have to provide name resolution for your local network.
-
Thanks, I've check the linux host file, it seem to be ok (I test with a windows and linux machine).
But still the same :(Now I need to see the IT guy for the DNS.
Thanks for your help.