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

PROLOG

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

NAME

12       endhostent, gethostent, sethostent — network host database functions
13

SYNOPSIS

15       #include <netdb.h>
16
17       void endhostent(void);
18       struct hostent *gethostent(void);
19       void sethostent(int stayopen);
20

DESCRIPTION

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

RETURN VALUE

47       Upon successful completion, the gethostent() function  shall  return  a
48       pointer  to a hostent structure if the requested entry was found, and a
49       null pointer if the end of the database was reached  or  the  requested
50       entry was not found.
51
52       The  application  shall  not  modify  the structure to which the return
53       value points, nor any storage areas pointed to by pointers  within  the
54       structure.  The  returned  pointer,  and pointers within the structure,
55       might be invalidated or the structure or the  storage  areas  might  be
56       overwritten  by  a  subsequent  call  to  gethostent().   The  returned
57       pointer, and pointers within the structure, might also  be  invalidated
58       if the calling thread is terminated.
59

ERRORS

61       No errors are defined for endhostent(), gethostent(), and sethostent().
62
63       The following sections are informative.
64

EXAMPLES

66       None.
67

APPLICATION USAGE

69       None.
70

RATIONALE

72       None.
73

FUTURE DIRECTIONS

75       None.
76

SEE ALSO

78       endservent()
79
80       The Base Definitions volume of POSIX.1‐2017, <netdb.h>
81
83       Portions  of  this text are reprinted and reproduced in electronic form
84       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
85       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
86       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
87       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
88       event of any discrepancy between this version and the original IEEE and
89       The  Open Group Standard, the original IEEE and The Open Group Standard
90       is the referee document. The original Standard can be  obtained  online
91       at http://www.opengroup.org/unix/online.html .
92
93       Any  typographical  or  formatting  errors that appear in this page are
94       most likely to have been introduced during the conversion of the source
95       files  to  man page format. To report such errors, see https://www.ker
96       nel.org/doc/man-pages/reporting_bugs.html .
97
98
99
100IEEE/The Open Group                  2017                       ENDHOSTENT(3P)
Impressum