CDnsClient::GetHostByName
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. For most applications it is recommended that the GetHostAddress and GetHostName methods be used instead.

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

GetHostAddress, GetHostByAddress, GetHostInfo, GetHostName, GetHostServices, GetMailExchange, GetRecord, GetResolverAddress, RegisterServer


Copyright © 2008 Catalyst Development Corporation. All rights reserved.