Gets protocol entry from the /etc/protocols file.
Standard C Library (libc.a)
#include <netdb.h>
struct protoent *getprotoent ( )
The getprotoent 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 getprotoent subroutine retrieves protocol information from the /etc/protocols file. An application program can use the getprotoent subroutine to access a protocol name, its aliases, and protocol number.
The getprotoent subroutine opens and performs a sequential read of the /etc/protocols file. The getprotoent subroutine returns a pointer to a protoent structure, which contains the fields for a line of information in the /etc/protocols file. The netdb.h file defines the protoent structure.
Use the endprotoent subroutine to close the /etc/protocols file.
All applications containing the getprotoent 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.
Upon successful completion, the getprotoent subroutine returns a pointer to a protoent structure.
If an error occurs or the end of the file is reached, the getprotoent subroutine returns a null pointer.
/etc/protocols | Contains protocol information. |
The endprotoent subroutine, getprotobyname subroutine, getprotobynumber subroutine, setprotoent subroutine.
Sockets Overview in AIX 5L Version 5.2 Communications Programming Concepts.