I'm trying to use gethostbyaddr, string $ip_address
, to get the name of the machine that I point to with $ip_address
.
I have been given the case that, on the local machine the /etc/hosts
has several names defined for ip loop
, such that:
127.0.0.1 localhost test test2 test4
If I execute gesthostbyaddr(127.0.0.1)
, it always returns the first element (in this case, localhost
).
How could I get ALL the items, that is, localhost
, test
, test2
, test4
?
Is there a function similar to gethostbyaddr
that returns an array of the host?