| LPHOSTENT GetHostByName(
|
| |
LPCTSTR lpszHostName |
|
| );
|
The GetHostByName method returns a pointer to a HOSTENT structure which contains the results of
a successful search for the host specified in the name
parameter.
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.
Return Value
If the method succeeds, the return value is a pointer to a
HOSTENT structure. If the method fails, the return value is NULL.
To get extended error information, call GetLastError.
Remarks
The application must never attempt to modify this structure or
to free any of its components. Only one copy of this structure is
allocated per thread, so the application should copy any
information it needs before issuing any other function calls. This
method will automatically resolve an IP address passed as a string,
converting it to numeric form and calling the
GetHostByAddress method.
This method is included for compatibility with existing
applications which already use the HOSTENT structure. Because this
method returns a pointer to a complex structure, it may not be
suitable for some programming languages.
This method is not compatible with IPv6 addresses. For
applications that must support both IPv4 and IPv6 address formats,
use the GetHostAddress and GetHostName methods.
Requirements
Client: Requires Windows 7, Windows Vista or Windows
XP.
Server: Requires Windows Server 2008 or Windows Server
2003.
Header: Include cstools7.h.
Library: Use csdnsav7.lib.
Unicode: Implemented as Unicode and ANSI versions.
See Also
GetHostAddress, GetHostByAddress, GetHostInfo, GetHostName, GetHostServices, GetMailExchange, GetRecord, GetResolverAddress, RegisterServer
|