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

litao cheng <>
Sun Oct 26 15:45:56 CET 2008


thank you very much!
that's ok!
:)

2008/10/26 Matthew Dempsky <>

> 2008/10/25 litao cheng <>:
> > I can use the ifconfig to see the ip address of eth0 is 192.168.1.101, I
> > want to get this value. how can I do it?
>
> Computers have more than one IP address.  E.g., yours has both
> 127.0.0.1 and 192.168.1.101.  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/20081026/f40d270f/attachment.html>


More information about the erlang-questions mailing list