1

I'm building an app on android but I have a problem with this

InetAddress.getByName(ipAddres).getHostName() return ip Addres

Java

InetAddress.getByName(IpAddres).getHostName() return hostname

so why on android the same code gives the ip address and not the hostname, I need the hostname

4aRk Kn1gh7
  • 4,259
  • 1
  • 30
  • 41
  • Does this answer your question? [Cannot get hostname from getHostName](https://stackoverflow.com/questions/1899288/cannot-get-hostname-from-gethostname) – Devabc Nov 28 '21 at 22:43

1 Answers1

0

check your DNS server, had a similar issue. I installed and configured dnsmasq and was able to get the hostnames from ip addresses

  • is the same code the first on runs on a pc the second on android emulator, also tried on real device same result, I dont have a dns server I,m testing on lan computers maybe is the cable modem or something like that? – user3525706 Oct 13 '14 at 04:58