COHERENT manpages
This page displays the COHERENT manpage for getnetbyname() [Get a network entry by address].
List of available manpages
Index
getnetbyname() -- Sockets Function (libsocket)
Get a network entry by address
#include <netdb.h>
struct netent *getnetbyname(name)
char *name;
getnetbyname() fetches a network entry. It opens and searches file
/etc/networks, which describes all entities on your local network, for the
entry with name. /etc/networks must have been opened by function
setnetent().
getnetbyname() 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 cannot find an entry with address.
See Also
endnetent(),
getnetent(),
getnetbyaddr(),
libsocket,
netdb.h,
setnetent()