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

Technical Reference: Communications, Volume 2

endprotoent Subroutine

Purpose

Closes the /etc/protocols file.

Library

Standard C Library (libc.a)

Syntax

void endprotoent (void)

Description

The endprotoent subroutine closes the /etc/protocols file.

Calls made to the getprotoent subroutine, getprotobyname subroutine, or getprotobynumber subroutine open the /etc/protocols file. An application program can use the endprotoent subroutine to close the /etc/protocols file.

All applications containing the endprotoent 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.

Return Values

If a previous setprotoent subroutine has been performed and the StayOpen parameter does not equal 0, the endprotoent subroutine will not close the /etc/protocols file. Also, the setprotoent subroutine does not indicate that it closed the file. A second setprotoent subroutine has to be issued with the StayOpen parameter equal to 0 in order for a following endprotoent subroutine to succeed. If this is not done, the /etc/protocols file closes on an exit subroutine.

Examples

To close the /etc/protocols file, type:

endprotoent();

Files

/etc/protocols Contains protocol names.

Related Information

The exit subroutine, getprotobynumber subroutine, getprotobyname subroutine, getprotoent subroutine, setprotoent 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 ]