How do I find my own IP address?

Joachim Durchholz <>
Thu Jan 22 19:13:41 CET 2004


Samuel Rivas wrote:
> Of course if you have more than one interface with more than one ip you
> could not get *THE* host ip. And obviously if you want to know the ip of
> any other interface, say loopback interface (and guess what it would be
> ;), this patch solves your problem:
> 
> - prim_inet:ifget(S, "eth0", [addr]).
> + prim_inet:ifget(S, "lo", [addr]).

I think that won't solve Joe's problem, since this just pushes the 
problem back, from "knowing all IP addresses" to "knowing all interfaces".

I've still got a nagging feeling that Joe is on the wrong trail. 
Applications should never be required to chase for IP addresses (or, for 
that matter, for domain names).
Of course I might be wrong - I'm not an X guru, it's just that I've been 
setting up my Linux box in the past weeks and learned more about IP than 
I ever wanted ;-} (and, of course, in a haphazard manner so it's easy to 
overlook some details).

Regards,
Jo
--
Currently looking for a new job.




More information about the erlang-questions mailing list