.TH inet_network() "" "" "Sockets Function (libsocket)"
.PC "Transform an IP address from text to an integer"
.B "#include <netinet/in.h>"
.B "#include <arpa/inet.h>"
.B "#include <sys/types.h>"
\fBulong inet_network(\fIip_address\^\fB)\fR
\fBchar *\fIip_address\^\fB;\fR
.PP
Function
.B inet_network()
translates an Internet-protocol (IP) address from text into a long integer.
.I ip_address
gives the address where the string that holds the IP address
resides in memory.
.PP
If all goes well,
.B inet_network()
returns the integer that it built from
.IR ip_address .
If, however,
.I ip_address
points to a malformed Internet address,
.B inet_network()
returns \-1.
.PP
An IP address consists of four bytes.
The four bytes normally are written as four numbers
that are separated by periods;
for example, ``199.3.32.100''.
.II "IP dot notation"
.II "dot notation"
This way of rendering an IP address is called
.IR "dot notation" .
Each byte can as a written as a decimal, octal, or hexadecimal number.
By default, a numbers is written in decimal;
a leading ``0x'' or ``0X'' indicates hexadecimal,
and a leading `0' indicates octal.
.PP
Unlike the function
.BR inet_addr() ,
.B inet_network()
translates
.I ip_addr
into an unsigned long (32-bit) integer.
This is the form suitable for a network address.
.SH "See Also"
.Xr "inet_addr()," inet_addr
.Xr "libsocket" libsocket
