[erlang-questions] : Finding IP addresses in a PC

David Hopwood david.nospam.hopwood@REDACTED
Wed Oct 4 17:05:05 CEST 2006


Raimo Niskanen wrote:
> Hello.
> 
> I am trying to pursue this bug, and i want to know which
> function you used since I can not find GetAdaptorsInfo on
> msdn.microsoft.com.

<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/getadaptersinfo.asp>

You need to #include <iphlpapi.h> and <iptypes.h>. Note that this API has some
limitations (no IPv6 support, only one address returned per adapter), but it is
available on Windows versions earlier than XP. Ideally, Erlang would use
GetAdaptersAddresses if available, and fall back to GetAdaptersInfo if not.

An "adapter" corresponds to a connection in 'Network Connections' (I also have
code to get the Network Connection name for each adapter, if you need that, but
it relies on undocumented registry entries).

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





More information about the erlang-questions mailing list