CInternetServer::EnumNetworkAddresses Method  
 
INT EnumNetworkAddresses(
  INT nAddressFamily,  
  LPINTERNET_ADDRESS lpAddressList,  
  INT nMaxAddresses  
);
INT EnumNetworkAddresses(
  LPINTERNET_ADDRESS lpAddressList,  
  INT nMaxAddresses  
);

The EnumNetworkAddresses method returns the list of network addresses that are configured for the local host.

Parameters

nAddressFamily
An integer which identifies the type of IP address that should be returned by this function. It may be one of the following values:
Value Description
INET_ADDRESS_ANY Return both IPv4 or IPv6 addresses for the local host, depending on how the system is configured and which network interfaces are enabled. This option is only recommended for applications that support IPv6.
INET_ADDRESS_IPV4 Specifies that the addresses should be in IPv4 format. The first four bytes of the ipNumber array are significant and contains the IP address. The remaining bytes are not significant and an application should not depend on them having any particular value, including zero.
INET_ADDRESS_IPV6 Specifies that the addresses should be in IPv6 format. All bytes in the ipNumber array are significant.
lpAddressList
A pointer to an array of INTERNET_ADDRESS structures that will contain the IP address of each local network interface.
nMaxAddresses
Maximum number of addresses to be returned.

Return Value

If the function succeeds, the return value is the number of network addresses that are configured for the local host. If the function fails, the return value is INET_ERROR. To get extended error information, call InetGetLastError.

Remarks

If the nAddressFamily parameter is specified as INET_ADDRESS_ANY, the application must be prepared to handle IPv6 addresses because it is possible that an IPv6 address string has been specified. For legacy applications that only recognize IPv4 addresses, the nAddressFamily member should always be specified as INET_ADDRESS_IPV4 to ensure that only IPv4 addresses are returned.

If this method is called without specifying the address family, the value INET_ADDRESS_IPV4 is used. This is provided primarily for compatibility with legacy applications and it is recommended that you explicitly specify the address family.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cswsock11.h
Import Library: cswskv11.lib

See Also

FormatAddress, GetHostAddress, GetHostName