sethostent()--Open Local Host Table


  Syntax
 #include <netdb.h>

 void sethostent(int stay_open)

  Service Program Name: QSOSRV2

  Default Public Authority: *USE

  Threadsafe: No; see Usage Notes.

The sethostent() function is used to prepare for sequential access to the local host table. sethostent() opens the table and repositions to the beginning of the table. In addition, sethostent() affects what type of transport service (connectionless versus connection-oriented) is to be used when gethostbyname() and gethostbyaddr() 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() and gethostbyaddr(). A nonzero value results in the local host table being left open. Also, a nonzero value results in the use of a connection-oriented transport service (for example, TCP) being used by gethostbyname() and gethostbyaddr() when host information is to be obtained from the domain name server.

Authorities

No authorization is required.


Error Conditions

When sethostent() fails, h_errno (defined in <netdb.h>) can be set to one of the following:

NO_RECOVERY

An unrecoverable error has occurred.


Usage Notes

  1. System i® Navigator or the following CL commands can be used to access the local host table:


  2. Do not use the sethostent() function in a multithreaded environment. See the multithread alternative sethostent_r() function.

  3. When you develop in C-based languages and an application is compiled with the _XOPEN_SOURCE macro defined to the value 520 or greater, the sethostent() API is mapped toqso_sethostent98().

Related Information



API introduced: V3R1

[ Back to top | UNIX-Type APIs | APIs by category ]