|
|
| INT
GetHostAddress(
|
|
|
LPCTSTR
lpszHostName, |
|
|
|
|
LPTSTR
lpszHostAddress, |
|
|
|
|
INT
cchHostAddress |
|
|
| );
|
| INT
GetHostAddress(
|
|
|
LPCTSTR
lpszHostName, |
|
|
|
|
CString&
strHostAddress |
|
|
| );
|
The GetHostAddress method resolves the specified host
name, storing the IP address in the provided buffer. The IP address
format is in common dot notation, with each byte of the address
separated by a period.
Parameters
- lpszHostName
- Pointer to the string that contains the hostname to be
resolved. If a fully qualified domain name is not provided, the
default local domain will be used.
- lpszHostAddress
- Pointer to the buffer that will contain the IP address, stored
as a null-terminated string in dot notation. This buffer should be
at least 16 characters in length.
- cchHostAddress
- 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 GetLastError.
Remarks
The GetHostAddress method first looks to see if there is
an entry in the local host file for the specified host name, and if
one exists, it will return that value.
If you do not want to use the local host file at all, and only
return an address if a DNS query resolves the host name, use the
GetRecord method and specify a record type of
DNS_RECORD_ADDRESS.
Requirements
Client: Requires Windows Vista, Windows XP or Windows
2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or
Windows 2000 Server.
Header: Include cstools6.h.
Library: Use csdnsav6.lib.
Unicode: Implemented as Unicode and ANSI versions.
See Also
EnumHostAliases, GetHostByAddress, GetHostByName, GetHostFile, GetHostName, GetRecord, SetHostFile
|
|