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

Technical Reference: Communications, Volume 2

setprotoent Subroutine

Purpose

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

Library

Standard C Library (libc.a)

Syntax


#include <netdb.h>

void setprotoent (StayOpen)
int StayOpen;

Description

The setprotoent 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 setprotoent subroutine opens the /etc/protocols file and sets the file marker to the beginning of the file.

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.

Parameters

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.

Files

/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 5L Version 5.2 Communications Programming Concepts.

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