Retrieves a network host entry.
Standard C Library (libc.a) (libbind) (libnis) (liblocal)
#include <netdb.h> struct hostent *gethostent ()
When using DNS/BIND name service resolution, gethostent is not defined.
When using NIS name service resolution or searching the local /etc/hosts file, the gethostent subroutine reads the next line of the /etc/hosts file, opening the file if necessary.
The gethostent subroutine returns a pointer to a hostent structure, which contains the equivalent fields for a host description line in the /etc/hosts file. The hostent structure is defined in the netdb.h file.
Upon successful completion, the gethostent subroutine returns a pointer to a hostent structure.
Note: The return value points to static data that is overwritten by subsequent calls, so it must be copied to be saved.
If an error occurs or the end of the file is reached, the gethostent subroutine returns a null pointer.
The gethostent subroutine is part of Base Operating System (BOS) Runtime.
/etc/hosts | |
Contains the host name database. | |
/etc/netsvc.conf | Contains the name services ordering |
/usr/include/netdb.h | Contains the network database structure. |
The gethostbyaddr subroutine, gethostbyname subroutine, sethostent subroutine endhostent subroutine.
Sockets Overview and Network Address Translation in AIX Version 4.3 Communications Programming Concepts.