[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2


sethostent Subroutine

Purpose

Opens network host file.

Library

Standard C Library (libc.a)
(libbind)
libnis)
(liblocal)

Syntax


#include <netdb.h>

sethostent ( StayOpen)
int StayOpen;

Description

When using the sethostent subroutine in DNS/BIND name service resolution, sethostent allows a request for the use of a connected socket using TCP for queries. If the StayOpen parameter is non-zero, this sets the option to send all queries to the name server using TCP and to retain the connection after each call to gethostbyname or gethostbyaddr.

When using the sethostent subroutine to search the /etc/hosts file, sethostent opens and rewinds the /etc/hosts file. If the StayOpen parameter is non-zero, the hosts database is not closed after each call to gethostbyname or gethostbyaddr.

Parameters


StayOpen When used in NIS name resolution and to search the local /etc/hosts file, it contains a value used to indicate whether to close the host file after each call to gethostbyname and gethostbyaddr. A non-zero value indicates not to close the host file after each call and a zero value allows the file to be closed.
  When used in DNS/BIND name resolution, a non-zero value retains the TCP connection after each call to gethostbyname and gethostbyaddr . A value of zero allows the connection to be closed.

Implementation Specifics

The sethostent subroutine is part of Base Operating System (BOS) Runtime.

Files


/etc/hosts Contains the host name database.
/etc/netsvc.conf Contains the name services ordering.
/etc/include/netdb.h Contains the network database structure.

Related Information

The endhostent subroutine, gethostbyaddr subroutine, gethostbyname subroutine, gethostent subroutine.

Sockets Overview and Network Address Translation in AIX 5L Version 5.1 Communications Programming Concepts.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]