1ENDHOSTENT(3P) POSIX Programmer's Manual ENDHOSTENT(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 endhostent, gethostent, sethostent - network host database functions
13
15 #include <netdb.h>
16
17 void endhostent(void);
18 struct hostent *gethostent(void);
19 void sethostent(int stayopen);
20
21
23 These functions shall retrieve information about hosts. This informa‐
24 tion is considered to be stored in a database that can be accessed
25 sequentially or randomly. The implementation of this database is
26 unspecified.
27
28 Note: In many cases this database is implemented by the Domain Name
29 System, as documented in RFC 1034, RFC 1035, and RFC 1886.
30
31
32 The sethostent() function shall open a connection to the database and
33 set the next entry for retrieval to the first entry in the database. If
34 the stayopen argument is non-zero, the connection shall not be closed
35 by a call to gethostent(), gethostbyname(), or gethostbyaddr(), and the
36 implementation may maintain an open file descriptor.
37
38 The gethostent() function shall read the next entry in the database,
39 opening and closing a connection to the database as necessary.
40
41 Entries shall be returned in hostent structures. Refer to gethost‐
42 byaddr() for a definition of the hostent structure.
43
44 The endhostent() function shall close the connection to the database,
45 releasing any open file descriptor.
46
47 These functions need not be reentrant. A function that is not required
48 to be reentrant is not required to be thread-safe.
49
51 Upon successful completion, the gethostent() function shall return a
52 pointer to a hostent structure if the requested entry was found, and a
53 null pointer if the end of the database was reached or the requested
54 entry was not found.
55
57 No errors are defined for endhostent(), gethostent(), and sethostent().
58
59 The following sections are informative.
60
62 None.
63
65 The gethostent() function may return pointers to static data, which may
66 be overwritten by subsequent calls to any of these functions.
67
69 None.
70
72 None.
73
75 endservent(), gethostbyaddr(), the Base Definitions volume of
76 IEEE Std 1003.1-2001, <netdb.h>
77
79 Portions of this text are reprinted and reproduced in electronic form
80 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
81 -- Portable Operating System Interface (POSIX), The Open Group Base
82 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
83 Electrical and Electronics Engineers, Inc and The Open Group. In the
84 event of any discrepancy between this version and the original IEEE and
85 The Open Group Standard, the original IEEE and The Open Group Standard
86 is the referee document. The original Standard can be obtained online
87 at http://www.opengroup.org/unix/online.html .
88
89
90
91IEEE/The Open Group 2003 ENDHOSTENT(3P)