logo       

RE: How do I find my own IP address?: msg#00228

lang.erlang.general

Subject: RE: How do I find my own IP address?

<snip>

>> 2> inet:gethostbyname("enfield").
>>
>> {ok,{hostent,"localhost.localdomain",
>> ["localhost","enfield"],
>> inet,
>> 4,
>> [{127,0,0,1}]}}
>>
>> But 127.0.0.1 is not my IP address
>>

<snip>

>before using undocumented functions i would suggest a close
>look at the
>configuration of your computer. the #hostent{} claims your canonical
>name is "localhost.localdomain". this does not sound correct.
>what does your /etc/hosts say?

Actually, the default hostname for RedHat Linux Workstation (others may vary)
has been "localhost.localdomain" for as long as I've been using it (5 years
now).

Also, the actual IP address of a workstation may vary according to the
information available at startup, especially if DHCP is selected. If no network
connection is available, then it would not suprise me if DHCP gave you
127.0.0.1 as your IP address.

>
>bengt
>

Simon



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise