| |
| INT GetLocalAddress( |
| |
INT nAddressFamily, |
|
| |
LPTSTR lpszAddress, |
|
| |
INT nMaxLength |
|
| ); |
The DnsGetLocalAddress method returns the IP address for
the local host.
- nAddressFamily
- An integer value which specifies the type of address that
should be returned. A value of DNS_ADDRESS_IPV4 specifies that the IPv4
address for the host should be returned. A value of DNS_ADDRESS_IPV6
specifies that the IPv6 address for the host should be returned. A
value of DNS_ADDRESS_ANY specifies that if the host only has an IPv6
address, that value should be returned, otherwise return the IPv4
address for the host.
- lpszAddress
- Pointer to the buffer that will contain the IP address, stored
as a string in dot notation. This buffer should be
at least 40 characters in length to accommodate both IPv4 and IPv6
addresses.
- nMaxLength
- The maximum length of the string buffer.
Return Value
If the method succeeds, the return value is the number of
characters copied into the host address buffer. If the method fails,
the return value is DNS_ERROR. To get extended error information,
call DnsGetLastError.
Remarks
The GetLocalAddress method may return an address in either
IPv4 or IPv6 format, depending on the address family that is
specified and what records exist for the host. If your application
does not support the IPv6 address format, you must specify the
nAddressFamily parameter as DNS_ADDRESS_IPV4 to prevent the possibility
of an IPv6 address being returned.
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csdnsv12.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
|
|