in reply to gethostbyname

Most OSs let the administrator configure how the process of "name resolution" (converting names to addresses) takes place. Some common options, and they can be used individually or searched in some configurable order, are: a local file (e.g. HOSTS or /etc/hosts), a NIS database, or DNS the Domain Name System. The later is a distributed database of name to address (and the reverse) mappings. You may have an internal DNS and the Internet has one for its names (e.g. www.perlmonks.org).

A domain administrator can put in hostname-address pairs for addresses that don't exist. vroom or the administrator for perlmonks could put in "nosuchhost.perlmonks.org" at some address. This might be for testing. A name could also resolve to an address of a host that was offline becuse it was failing or down for maintenance. DNS, hosts, and NIS only return the mappings. This is probably from the traditional UNIX philosophy that a tool should do one thing and do it well. If you want to see if a host exists, try to access it. ping might work if it is not blocked at a firewall, but it might not.

HTH, --traveler