[erlang-questions] Finding IP addresses in a PC

David Hopwood david.nospam.hopwood@REDACTED
Tue Oct 3 22:15:00 CEST 2006


Jordan Wilberding wrote:
> On my computer it returns:
> 
> {ok,["lo","eth0"]}
> 
> But anyways, the strings are just in reverse, so do this:
> 
>  lists:map(fun(X) -> lists:reverse(X) end, List)
> 
> where List is ["51.0.861.291","100.0.0.721"] in your case.

That would produce the wrong result (192.168.0.15 instead of
192.168.0.150).

Has anyone tried to investigate this strange bug? I've written C code
to get the interface list on Windows, using GetAdaptorsInfo, and that
function seemed to do precisely what the MSDN documentation said it
should do.

-- 
David Hopwood <david.nospam.hopwood@REDACTED>





More information about the erlang-questions mailing list