| |
| INT WINAPI DnsGetLocalAddress( |
| |
HCLIENT hClient, |
|
| |
INT nAddressFamily, |
|
| |
LPTSTR lpszAddress, |
|
| |
INT nMaxLength |
|
| ); |
The DnsGetLocalAddress function returns the IP address for
the local host.
- hClient
- Handle to the client session.
- 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 function succeeds, the return value is the number of
characters copied into the host address buffer. If the function
fails, the return value is DNS_ERROR. To get extended error
information, call DnsGetLastError.
Remarks
The DnsGetLocalAddress function 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: cstools11.h
Import Library: csdnsv11.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
DnsGetHostName,
DnsGetHostInfo,
DnsGetHostServices,
DnsGetMailExchange,
DnsGetRecord
|
|