How can i find my LAN IP Address using std.socket?
Craig Dillabaugh
cdillaba at cg.scs.carleton.ca
Tue Feb 4 08:15:09 PST 2014
On Tuesday, 4 February 2014 at 16:13:33 UTC, Dicebot wrote:
> On Tuesday, 4 February 2014 at 16:02:33 UTC, Craig Dillabaugh
> wrote:
>> However if I run /sbin/ifconfig I get:
>>
>> enp7s0 Link encap:Ethernet HWaddr 50:E5:49:9B:29:49
>> inet addr:10.1.101.52 Bcast:10.1.101.255
>> Mask:255.255.255.0
>> inet6 addr: fe80::52e5:49ff:fe9b:2949/64 Scope:Link
>>
>> lo Link encap:Local Loopback
>> inet addr:127.0.0.1 Mask:255.0.0.0
>> inet6 addr: ::1/128 Scope:Host
>>
>> This computer is on a network with dynamically assigned IP
>> address (DHCP).
>> So shouldn't the 10.1.101.52 address have been reported?
>
> It results in all addresses you hostname resolvs to. On all
> desktop linux machines /etc/hosts is configured to resolve
> hostname to "localhost" by default. On servers it usually
> resolves to externally accessible one.
Thanks.
More information about the Digitalmars-d-learn
mailing list