Topic Path: Symbol Reference > Classes > TIdStackWindows Class > TIdStackWindows Methods > HostByAddress Method
TIdStackWindows.HostByAddress Method

Resolves an IP address to its host name.

function HostByAddress(
    const AAddress: string; 
    const AIPVersion: TIdIPVersion = ID_DEFAULT_IP_VERSION
): string; override;
IP address to resolve to a host name.
IP version for the request. Default value is ID_DEFAULT_IP_VERSION

string - Host name for the specified IP address.

HostByAddress is an overridden string function used to resolve the IP address in AAddress to a host name. 

AIPVersion indicates the IP address format, and determines the processing performed to resolve the IP address. 

When AIPVerstion contains Id_IPv4, the value in AAddress is converted using inet_addr and passed to GetHostByAddr. CHekForSocketError is called to handle error responses. 

When AIPVerstion contains Id_IPv6, getaddrinfo is called using AAddress to resolve the IP Address to a canonical name. CheckSocketError is called to handle error responses. If IdIPv6Available indicates that IPv6 addresses are not supported, then an EIdIPv6Unavailable exception is raised. 

HostByAddress calls IPVersionUnsupported when AIPVersion contains a value other than Id_IPv4 or Id_IPv6.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.