sethostent()

Updated: May 06, 2022

Open the host database file

Synopsis:

#include <netdb.h>

void sethostent( int stayopen );

Arguments:

stayopen
Nonzero if you want all queries to the name server to use TCP and you want the connection to be retained after each call to gethostbyname() or gethostbyaddr().

If the stayopen flag is zero, queries use UDP datagrams.

Library:

libsocket

Use the -l socket option to qcc to link against this library.

Description:

The sethostent() routine opens the host database file.

You can use the sethostent() function to request the use of a connected TCP socket for queries.

Classification:

POSIX 1003.1

Safety:  
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread No

Caveats:

This function uses static data; if you need the data for future use, you should copy it before any subsequent calls overwrite it.