Microsoft Internet Security and Acceleration Server 2004 SDK


The GetHostByName method retrieves host information corresponding to a host name. This method is similar to the Winsock gethostbyname function.

HRESULT GetHostByName(
  const char* name,
  char* buf,
  int* buflen


[in] Pointer to a null-terminated string that specifies the name of the host. UTF-8 encoding is expected in this parameter.
[out] Pointer to the data area to receive the hostent data. The data area must be larger than the size of a hostent structure because the supplied data area is used by Windows Sockets to contain a hostent structure and all of the data referenced by members of the hostent structure. A buffer of MAXGETHOSTSTRUCT bytes is recommended. The strings returned in the structure are encoded using the current system ANSI code page (ACP).
[in, out] On input, specifies the size of data area for the buf parameter. If the buffer is too small, the error code HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) is returned and the buflen parameter receives the size of the required buffer.

Return Values

Success, the buffer was filled with the host information.
Insufficient buffer space was provided. That is, the buffer pointed to by the buf parameter is not large enough to contain the host information. For more information, see the description of the buflen parameter.
The name specified could not be found in the relevant database.
No response was received from an authoritative server.
The name specified is valid and was found in the database, but no information of the type requested is associated with it.


Unlike the IFWXSession::GetHostByName method, this method does not check permissions or policy rules, does not log the name resolution, and cannot use autodial to dial out for the name resolution.


Server: Requires Windows Server 2003 or Windows 2000.
Version: Requires Internet Security and Acceleration Server 2004.
Header: Declared in Wspfwext.idl.

See Also

IFWXFirewall, IFWXSession::GetHostByName