hostent

Structure that describes an Internet host

Synopsis:

#include <netdb.h>

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]

Description:

This structure describes an Internet host. It contains either the information obtained from a name server, or broken-out fields from a line in /etc/hosts .

The members of this structure are:

h_name
The official name of the host.
h_aliases
A zero-terminated array of alternate names for the host.
h_addrtype
The type of address being returned; currently always AF_INET.
h_length
The length of the address, in bytes.
h_addr_list
A zero-terminated array of network addresses for the host. Host addresses are returned in network byte order.

A #define statement is used to define the following:

h_addr
The first address in h_addr_list. This is for backward compatibility.

Classification:

POSIX 1003.1

Last modified: 2013-12-23

comments powered by Disqus