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

endservent Subroutine

Purpose

Closes the /etc/services file.

Library

Standard C Library (libc.a)

Syntax

#include <netdb.h>
void endservent ( )

Description

The endservent subroutine closes the /etc/services file. A call made to the getservent subroutine, getservbyname subroutine, or getservbyport subroutine opens the /etc/services file. An application program can use the endservent subroutine to close the /etc/services file.

Return Values

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

Examples

To close the /etc/services file:

endservent ();

Implementation Specifics

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

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

Files

/etc/services
                          Contains service names.

Related Information

The endprotoent subroutine, exit subroutine, getprotobyname subroutine, getprotobynumber subroutine, getprotoent subroutine, getservbyname subroutine, getservbyport subroutine, getservent subroutine, setprotoent subroutine, setservent subroutine.

Sockets Overview, Understanding Network Address Translation, and List of Socket Programming References in AIX Version 4.3 Communications Programming Concepts.


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