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

setprotoent Subroutine


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


Standard C Library (libc.a)


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


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

The setprotoent subroutine opens the /etc/protocols file and sets the file marker to the beginning of the file.


StayOpen Indicates when to close the /etc/protocols file.

Specifying a value of 0 closes the file after each call to getprotoent.

Specifying a nonzero value allows the /etc/protocols file to remain open after each subroutine.

Return Values

The return value points to static data that is overwritten by subsequent calls.

Implementation Specifics

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

All applications containing the setprotoent 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/protocols Contains the protocol names.

Related Information

The endprotoent subroutine, getprotobyname subroutine, getprotobynumber subroutine, getprotoent subroutine.

Sockets Overview and Understanding Network Address Translation in AIX Version 4.3 Communications Programming Concepts.

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