[erlang-questions] how to get the factual ip address?
Sun Oct 26 00:10:54 CEST 2008
2008/10/25 litao cheng <litaocheng@REDACTED>:
> 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.
More information about the erlang-questions