[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Communications Technical Reference, Volume 2

setnetent Subroutine


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


Standard C Library (libc.a)


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


Attention: Do not use the setnetent subroutine in a multithreaded environment.

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


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.

Implementation Specifics

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

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.


/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 Version 4.3 Communications Programming Concepts.

[ Previous | Next | Contents | Glossary | Home | Search ]