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

Technical Reference: Communications, Volume 2

setnetent Subroutine

Purpose

Opens the /etc/networks file and sets the file marker.

Library

Standard C Library (libc.a)

Syntax


#include <netdb.h>
void setnetent (StayOpen)
int StayOpen;

Description

The setnetent subroutine is threadsafe in AIX 4.3 and later. However, the return value points to static data that is overwritten by subsequent calls. This data must be copied to be saved for use by subsequent calls.

The setnetent subroutine opens the /etc/networks file and sets the file marker at the beginning of the file.

All applications containing the setnetent subroutine must be compiled with _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.

Parameters

StayOpen Contains a value used to indicate when to close the /etc/networks file.

Specifying a value of 0 closes the /etc/networks file after each call to the getnetent subroutine.

Specifying a nonzero value leaves the /etc/networks file open after each call.

Return Values

If an error occurs or the end of the file is reached, the setnetent subroutine returns a null pointer.

Files

/etc/networks Contains official network names.

Related Information

The endnetent subroutine, getnetbyaddr subroutine, getnetbyname subroutine, getnetent subroutine.

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

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