z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


gethostent()

z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
SC27-3660-00

The gethostent() call returns the next line in the local host table for a host name and points to the next host entry in the local host table. The gethostent() call also returns any aliases. The gethostent() call is available only when RESOLVE_VIA_LOOKUP is defined before MANIFEST.H is included. See z/OS Communications Server: IP Configuration Guide for information about using local host tables.

#include <manifest.h>
#include <netdb.h>
struct hostent *gethostent()
The NETDB.H header file defines the hostent structure and contains the following elements:
Element
Description
h_name
The address of the official name of the host
h_aliases
A pointer to a zero-terminated list of addresses pointing to alternate names for the host
h_addrtype
The type of host address returned; currently set to AF_INET
h_length
The length of the host address, in bytes
h_addr
A pointer to the network address of the host

Return values

The return value points to static data that is overwritten by subsequent calls. A pointer to a hostent structure indicates success. A NULL pointer indicates an error or EOF. When a NULL pointer or 0 is returned, the value of errno is indeterminate, and, therefore, the output from a tcperror() call is also not valid.

Related calls

gethostbyname(), sethostent()

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014