[erlang-questions] how to get the factual ip address?

Alex Alvarez <>
Wed Oct 29 09:22:02 CET 2008

getif/0 and getiflist/0 seem very useful, but shouldn't their output be in
sync order-wise with each other?

getif/0 in my machine outputs...


, while getiflist/0 outputs...


This might be a problem if you had several more interfaces available.
Knowing the output of both are always in sync might simplify things out.

Cheers, Alex

>Computers have more than one IP address.  E.g., yours has both
> <> and  Other computers have even
more.  The
>inet module has undocumented functions getif/0 and getiflist/0 that
>might do what you want.
>Another possibility is to call inet:sockname/1 on an open socket to
>find what address the operating system used.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081029/7f261e77/attachment.html>

More information about the erlang-questions mailing list