[Vm-dev] unix nameToAddr() function appears to not work on Raspbian?

Hans-Martin Mosner hmm at heeg.de
Sat Sep 19 06:46:47 UTC 2015


Am 18.09.2015 um 19:50 schrieb tim Rowledge:
> ...So I’m puzzled since surely asking for an IP address for the machine is a common thing?
Actually, as David already stated, asking for *the* IP address for a machine is asking for trouble.
The IP address returned (127.0.1.1) is one of the several IP addresses the machine has (via its several network
interfaces), so it's perfectly correct, just not usable for your purpose.
A somewhat more usable function would enumerate all IP addresses of all interfaces and return one that is designated as
public. However, in many situations a machine might be behind a NAT gateway and only has one or several private IP
addresses. Determining which of these is the one that you want to use may be very situation-specific.
So the best thing would be to drop primitiveResolverLocalAddress() altogether, as it is meaningless. Instead enumerate
all interfaces with all addresses and allow the image to determine with suitable selection algorithms which one to use.

Cheers,
Hans-Martin



More information about the Vm-dev mailing list