#include <netdb.h>
struct netent *getnetent ( )
Attention: Do not use the getnetent subroutine in a multithreaded environment.
The getnetent subroutine retrieves network information by opening and sequentially reading the /etc/networks file.
The getnetent subroutine returns a pointer to a netent structure, which contains the equivalent fields for a network description line in the /etc/networks file. The netent structure is defined in the netdb.h file.
Use the endnetent subroutine to close the /etc/networks file.
Upon successful completion, the getnetent subroutine returns a pointer to a netent structure.
Note: The return value points to static data that is overwritten by subsequent calls.
If an error occurs or the end of the file is reached, the getnetent subroutine returns a null pointer.
The getnetent subroutine is part of Base Operating System (BOS) Runtime.
All applications containing the getnetent 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/networks | |
Contains official network names. |
The endnetent subroutine, getnetbyaddr subroutine, getnetbyname subroutine, setnetent subroutine.
Sockets Overview in AIX 5L Version 5.1 Communications Programming Concepts.