Chapter Contents

Previous

Next
sethostent

sethostent



Opens a Host File or Connects to a Name Server

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
PORTABILITY
IMPLEMENTATION
RELATED FUNCTIONS


SYNOPSIS

#include <netdb.h>

void sethostent(int stayopen);


DESCRIPTION

sethostent opens a host file or begins a connection with the name server.

In some instances, when the resolver is used to look up the host name, a virtual circuit (that is, a TCP connection) is used to communicate with the name server. This is based on the RESOLVEVIA statement in the TCPIP.DATA file or the RES_USEVC resolver option specified by your program. In these cases, you can use the RES_STAYOPEN resolver option to maintain the connection with the name server between queries.

In other instances, the host file is used as a source of host names. In this case, sethostent rewinds the file. This enables successive sethostent calls to read the host file sequentially. Specifying the stayopen parameter with sethostent causes the host file to remain open between gethostbyname and gethostbyaddr calls.

Refer to Network Administration for information on naming host files and the logic that determines whether the host file or the resolver is used for looking up names.


RETURN VALUE

sethostent does not return a value.


PORTABILITY

The logic that determines whether to use the host file or the resolver is not uniform across environments. At the source code level, however, sethostent is portable to other environments, including most UNIX systems, that implement BSD sockets.


IMPLEMENTATION

sethostent is a combination of the host file and resolver versions of the BSD UNIX Socket Library sethostent .


RELATED FUNCTIONS

endhostent , gethostent , gethostbyname


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.