COHERENT manpages
This page displays the COHERENT manpage for getnetent() [Fetch a network entry].
List of available manpages
Index
getnetent() -- Sockets Function
Fetch a network entry
#include <netdb.h>
struct netent *getnetent();
getnetent() fetches a network entry. It reads the next line of file
/etc/network, which describes all entities on your local network; if
necessary, it opens this file.
getnetent() returns a pointer to an object of type netend, which is defined
in header file <netdb.h>:
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net number type */
unsigned long n_net; /* net number */
};
The following describes the members:
n_name
The official name of the network.
n_aliases
This points to a zero-terminated list of alternate names for the
network.
n_addrtype
The type of the network number returned; currently, only type AF_INET
is recognized.
n_net
The network's number. Network numbers are returned in the machine's
byte order.
getnetent() returns a pointer to the netent structure it built. It returns
NULL if something went wrong or if it has reached the end of /etc/networks.
You must call function endnetent() to close /etc/networks.
See Also
getnetbyaddr(),
getnetbyname(),
endnetent(),
libsocket,
netdb.h,
setnetent()