On Tuesday, 4 February 2014 at 16:02:33 UTC, Craig Dillabaugh wrote:

This computer is on a network with dynamically assigned IP address (DHCP).
So shouldn't the 10.1.101.52 address have been reported?

Nope. In out-of-the-box simple network setups (i.e. home network in the form PC/laptop -> router -> internet) the address resolution won't go further than your hosts file, which in turn will always give you back the loopback address (more specifically, the address that is specified for the hostname in aforementioned file).

That's why both I and Dicebot mentioned there isn't any real way to query your local addresses without any live connection: only when a socket has a connection within a particular network can you tell your own IP address in that network. The address itself would depend on the network setup, your local routing configuration, etc. Your machine can have several network adaptors (ethernet boards, Wi-Fi, etc.), each configured with (numerous) routing setups, plus the routers they're connected to have their own routing setups... This can go on and on.

Reply via email to