#include <netdb.h>
int sethostent_r(int stay_open,
struct hostent_data *hostent_data_struct_addr)
Service Program Name: QSOSRV2
Default Public Authority: *USE
Threadsafe: Yes
The sethostent_r() function is used in preparation for sequential
access to the local host table. The sethostent_r() function opens
the table and repositions to the beginning of the table. In
addition, this call affects what type of transport service (connectionless
versus connection-oriented) that is to be used when gethostbyname_r()
and gethostbyaddr_r() need to retrieve host information from the
domain name server.
Parameters
int stay_open (input)
Specifies whether to leave the local host table open after each call to
gethostbyname_r() and gethostbyaddr_r(). A non-zero value
will result in the local host table being left open. Also, a non-zero value will
result in the use of a connection-oriented transport service (for example, TCP)
being used by gethostbyname_r() and gethostbyaddr_r() when
host information is to be obtained from the domain name server.
Specifies the pointer to the hostent_data structure, which is used to pass
and preserve results between function calls. The field host_control_blk in the
hostent_data structure must be initialized with hexadecimal zeros before its
initial use. If compatibility with other platforms is required, then the entire
hostent_data structure must be initialized to hexadecimal zeros before initial
use.
Authorities
No authorization is required.
Return Value
The sethostent_r() function returns an integer. Possible values
are:
-1 (unsuccessful call)
0 (successful call)
The struct hostent_datadenoted by
hostent_data_struct_addr is defined in
<netdb.h>.
Error Conditions
When the sethostent_r() function fails, h_errno (defined
in <netdb.h>) can be set to:
[NO_RECOVERY]
An unrecoverable error has occurred.
When the sethostent_r() function fails, errno can be set
to:
[EINVAL]
The hostent_data structure was not properly initialized to hexadecimal zeros before initial
use. For corrective action, see the description for structure hostent_data.
Usage Notes
System i® Navigator or the following CL commands can be
used to access the local host table:
ADDTCPHTE (Add TCP/IP Host Table Entry)
RMVTCPHTE (Remove TCP/IP Host Table Entry)
CHGTCPHTE (Change TCP/IP Host Table Entry)
RNMTCPHTE (Rename TCP/IP Host Table Entry)
MRGTCPHT (Merge TCP/IP Host Tables)
CFGTCP (Configure TCP/IP), option "10. Work with TCP/IP host table entries"