#include <netdb.h>
struct netent *getnetbyname (Name) char *Name;
Attention: Do not use the getnetbyname subroutine in a multithreaded environment.
The getnetbyname subroutine retrieves information from the /etc/networks file using the Name parameter as a search key. The getnetbyname subroutine searches the /etc/networks file sequentially from the start of the file until it encounters a matching net name or until it reaches the end of the file.
The getnetbyname 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.
Name | Points to a string containing the name of the network. |
Upon successful completion, the getnetbyname 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 getnetbyname subroutine returns a null pointer.
The getnetbyname subroutine is part of Base Operating System (BOS) Runtime.
All applications containing the getnetbyname 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, getnetent subroutine, setnetent subroutine.
Sockets Overview in AIX Version 4.3 Communications Programming Concepts.