|
INT ResolveAddress( |
|
DWORD dwAddress, |
|
|
LPTSTR lpszHostName, |
|
|
INT nMaxLength |
|
); |
INT ResolveAddress( |
|
DWORD dwAddress, |
|
|
CString& strHostName |
|
); |
The ResolveAddress method resolves a numeric IP address
into a fully qualified domain name.
Parameters
- dwAddress
- The IP address to be resolved, specified as an unsigned 32-bit
integer in network byte order.
- lpszHostName
- A pointer to a buffer that will contain a null-terminated
string that specifies the fully qualified domain name for the host.
It is recommended that this buffer be at least 64 characters in
length.
- nMaxLength
- The maximum number of characters that can be copied into the
string buffer, including the terminating null character.
Return Value
If the method succeeds, the return value is the length of the host
name. If the method fails, the return value is ICMP_ERROR. To get
extended error information, call GetLastError.
Remarks
The ResolveAddress method is used to perform a reverse DNS
lookup, converting a numeric IP address into a fully qualified domain
name. This is useful for methods like TraceRoute, which return
host addresses as numeric values in network byte order. If the
reverse DNS lookup fails because there is no PTR record for the given
IP address, a printable form of the address in dotted notation will
be returned in the string buffer.
Calling this method will cause the thread to block until the IP
address is resolved, or until the DNS query times out because there
is no reverse record for the address. In some cases, a reverse lookup
can take several seconds.
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: csicmv11.lib
See Also
GetHostAddress,
GetHostName,
SetHostAddress,
SetHostName,
TraceRoute
|
|