Retrieves a network host entry.
Standard C Library (libc.a)
(libbind)
(libnis)
(liblocal)
#include <netdb.h>
struct hostent *gethostent ()
The gethostent subroutine is threadsafe in AIX® 4.3 and later. However, the return value points to static data that is overwritten by subsequent calls. This data must be copied to be saved for use by subsequent calls.
When using DNS/BIND name service resolution, the gethostent subroutine 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.
If an error occurs or the end of the file is reached, the gethostent subroutine returns a null pointer.
Item | Description |
---|---|
/etc/hosts | Contains the host name database. |
/etc/netsvc.conf | Contains the name services ordering. |
/usr/include/netdb.h | Contains the network database structure. |