Parameters & Returns
Parameters
Returns
Quick Summary
Returns the number of IP addresses associated with a hostname.
Takes a hostname (String).
Returns the count of IP addresses, or 0 if lookup fails (Int).
Technical Exegesis...
Resolves the hostname using DNS and returns the count of IP addresses in the host's address list. Returns 0 if hostname is NULL or if DNS lookup fails. Uses gethostbyname to perform the DNS query.
Automatically initializes WinSock on first call. The hostname can be a domain name (e.g., "google.com") or the local machine name. Some hosts may have multiple IPs (e.g., load-balanced servers). Useful for checking DNS resolution and multi-homed hosts.