.TH getnetbyaddr() "" "" "Sockets Function (libsocket)"
.PC "Get a network entry by address"
.B "#include <netdb.h>"
\fBstruct netent *getnetbyaddr(\fInetwork\^\fB, \fItype\^\fB)\fR
\fBlong \fInetwork\^\fB; int \fItype\^\fB;\fR
.PP
.B getnetbyaddr()
fetches a network entry.
It opens and searches file
.BR /etc/network ,
which describes all entities on your local network,
for the entry with
.IR address .
.B /etc/networks
must have been opened by function
.BR setnetent() .
.I type
is the type of network; at present,
.B getnetbyaddr()
recognizes only type
.BR AF_INET .
.PP
.B getnetbyaddr()
returns a pointer to an object of type
.BR netend ,
which is defined in header file
.BR <netdb.h> :
.PP
.DM
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 */
};
.DE
.PP
The following describes the members:
.IP \fBn_name\fR
The official name of the network.
.IP \fBn_aliases\fR
This points to a zero-terminated list of alternate names for the network.
.IP \fBn_addrtype\fR
The type of the network number returned; currently, only type
.B AF_INET
is recognized.
.IP \fBn_net\fR
The network's number.
Network numbers are returned in the machine's byte order.
.PP
.B getnetent()
returns a pointer to the
.B netent
structure it built.
It returns NULL if something went wrong or if it cannot find an entry with
.IR address .
.SH "See Also"
.Xr "endnetent()," endnetent
.Xr "getnetent()," getnetent
.Xr "getnetbyname()," getnetbyn
.Xr "libsocket," libsocket
.Xr "netdb.h," netdb.h
.Xr "setnetent()" setnetent
