DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Developing applications over TCP/IP using Internet sockets

Mapping host names (Internet domain)

An Internet host name to address mapping is represented by the hostent data structure:

struct  hostent {
        char      *h_name;
        char     **h_aliases;
        int        h_addrtype;
        int        h_length;
        char     **h_addr_list;
# define           h_addr h_addr_list[0]
        }

*h_name
is the official name of the host.

**h_aliases
is the alias list.

h_addrtype
is the host address type.

h_length
is the length of address.

h_addr_list
is the address list.

h_addr
is the primary address.
The routine gethostbyname takes an Internet host name and returns a hostent structure. The gethostbyaddr routine maps Internet host addresses into a hostent structure. These two routines search for the contents for this structure in any or all of the following databases: the Domain Name Service (DNS), the Network Information Service (NIS), and the file /etc/hosts. The order and number of databases searched depends on the value assigned to the keyword hostresorder in the file /etc/resolv.conf (see resolver(SFF)). Note: These routines do not read /etc/resolv.conf directly. They invoke the resolver routine res_init (see resolver(SLIB)). If a host has more than one address associated with the same name, gethostbyname returns only the first entry found unless searching the DNS database; DNS returns all addresses associated with a host name.

(inet_netof is a standard routine which returns the network portion of an Internet address. See inet(SLIB).


Next topic: Mapping network names (Internet domain)
Previous topic: Networking library routines used for Internet sockets

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003