I'm currently working on a "list what's up in the local network"-tool and now i'm stuck at the "gimme a hostname for this IP"-part.
I already tried getnameinfo and gethostbyaddr, but the first one returns (almost) always the given IP instead of a hostname, the second one returns some strange stuff like ANantes-651-1-49-net.w2-0.abo.wanadoo.fr
...
My question is: How could i make this work?
Note: It's not like there is no hostname associated with at least one of the IPs, for example dig +short -x 192.168.178.1
return fritz.box.
as it should and also host 192.168.178.1
gives the correct answer
1.178.168.192.in-addr.arpa domain name pointer fritz.box.
Additional note: On my research i stumbled upon a library, called "adns", but by "stumbled upon" i mean "almost literally stumbled upon", as there's not the slightest trace of a documentation, examples or such... So if someone actually has an example on how to use "adns", that would be great...