I know how to get the name behind an ip address using the terminal and dig. I.e:
dig @224.0.0.251 -p5353 -x 192.168.0.195 +short
However, I don't want to use NSTask in my application. How can I use NSHost to get the name behind an ip address within a LAN? I tried this, but it always returns nil:
NSHost *myHost = [NSHost hostWithAddress:@"192.168.0.195"];
NSLog(@"name: %@", [myHost name]);
Thanks a lot!
Edit: These methods/functions... +[NSHost hostWithAddress:] gethostbyaddr(3) - A BSD function ...seem to be the same as:
dig -x 192.168.0.195
If I use that dig command in the terminal it says that no servers could be reached. (Yes I don't have a DNS server in my LAN), so no wonder I get back nil.
It would be great if I could implement dig @224.0.0.251 -p5353 -x 192.168.0.195 +short
(bonjour multicast lookup) in my app without having to use NSTask. :)