Network Interface Guide

hostent - Host Names

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

struct hostent {
	   char  *h_name;            /* official name of host */
	   char  **h_aliases;        /* alias list */
	   int   h_addrtype;         /* hostaddrtype(e.g.,AF_INET6) */
	   int   h_length;           /* length of address */
	   char  **h_addr_list;      /* list of addrs, null terminated */
/*1st addr, net byte order*/
#define h_addr h_addr_list[0]

getipnodebyname(3SOCKET) maps an Internet host name to a hostent structure, getipnodebyaddr(3SOCKET) maps an Internet host address to a hostent structure, freehostent(3SOCKET) frees the memory of a hostent structure, and inet_ntop(3SOCKET) maps an Internet host address to a displayable string.

The routines return a hostent structure containing the name of the host, its aliases, the address type (address family), and a NULL-terminated list of variable length addresses. The list of addresses is required because a host can have many addresses. The h_addr definition is for backward compatibility, and is the first address in the list of addresses in the hostent structure.