1ENDHOSTENT(P)              POSIX Programmer's Manual             ENDHOSTENT(P)
2
3
4

NAME

6       endhostent, gethostent, sethostent - network host database functions
7

SYNOPSIS

9       #include <netdb.h>
10
11       void endhostent(void);
12       struct hostent *gethostent(void);
13       void sethostent(int stayopen);
14
15

DESCRIPTION

17       These  functions  shall retrieve information about hosts. This informa‐
18       tion is considered to be stored in a  database  that  can  be  accessed
19       sequentially  or  randomly.  The  implementation  of  this  database is
20       unspecified.
21
22       Note:  In many cases this database is implemented by  the  Domain  Name
23              System, as documented in RFC 1034, RFC 1035, and RFC 1886.
24
25
26       The  sethostent()  function shall open a connection to the database and
27       set the next entry for retrieval to the first entry in the database. If
28       the  stayopen  argument is non-zero, the connection shall not be closed
29       by a call to gethostent(), gethostbyname(), or gethostbyaddr(), and the
30       implementation may maintain an open file descriptor.
31
32       The  gethostent()  function  shall read the next entry in the database,
33       opening and closing a connection to the database as necessary.
34
35       Entries shall be returned in  hostent  structures.  Refer  to  gethost‐
36       byaddr() for a definition of the hostent structure.
37
38       The  endhostent()  function shall close the connection to the database,
39       releasing any open file descriptor.
40
41       These functions need not be reentrant. A function that is not  required
42       to be reentrant is not required to be thread-safe.
43

RETURN VALUE

45       Upon  successful  completion,  the gethostent() function shall return a
46       pointer to a hostent structure if the requested entry was found, and  a
47       null  pointer  if  the end of the database was reached or the requested
48       entry was not found.
49

ERRORS

51       No errors are defined for endhostent(), gethostent(), and sethostent().
52
53       The following sections are informative.
54

EXAMPLES

56       None.
57

APPLICATION USAGE

59       The gethostent() function may return pointers to static data, which may
60       be overwritten by subsequent calls to any of these functions.
61

RATIONALE

63       None.
64

FUTURE DIRECTIONS

66       None.
67

SEE ALSO

69       endservent()  ,  gethostbyaddr()  ,  the  Base  Definitions  volume  of
70       IEEE Std 1003.1-2001, <netdb.h>
71
73       Portions of this text are reprinted and reproduced in  electronic  form
74       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
75       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
76       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
77       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
78       event of any discrepancy between this version and the original IEEE and
79       The Open Group Standard, the original IEEE and The Open Group  Standard
80       is  the  referee document. The original Standard can be obtained online
81       at http://www.opengroup.org/unix/online.html .
82
83
84
85IEEE/The Open Group                  2003                        ENDHOSTENT(P)
Impressum