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

Per Hedeland per@REDACTED
Thu Oct 30 00:01:59 CET 2008

"Alex Alvarez" <eeajam@REDACTED> wrote:
>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...
>     {{127,0,0,1},{0,0,0,0},{255,0,0,0}}]}
>, while getiflist/0 outputs...

Yes, that would make sense - seems it's a foldl that should be a foldr
in inet:getif/1. But anyway if you want to know the address for a
specific interface, you can use ifget/2 instead - e.g.:

3> inet:ifget("bge0", [addr]).

And unfortunately is seems none of the above support the fact that an
interface can have multiple addresses.

--Per Hedeland

More information about the erlang-questions mailing list