htonl(3) — Subroutines
NAME
htonl − Converts an unsigned 32-bit integer from host byte order to Internet network-byte order
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <netinetin.h> unsigned int htonl (
unsigned int hostint) ;
PARAMETERS
hostintSpecifies a 32-bit integer in host byte order.
DESCRIPTION
The htonl() (host-to-network long) function converts an unsigned 32-bit integer from host byte order to Internet network-byte order.
The Internet network requires address and port reference data in network-byte order (most significant byte leftmost, least significant byte rightmost). Use the htonl() function to convert address and port integers from Internet host byte order to Internet network-byte ordered integers.
The htonl() function is defined as a big-endian macro in the netinet/in.h header file for machine environments where network-byte order and host byte order are identical.
RETURN VALUES
Upon successful completion, the htonl() function returns a 32-bit integer in Internet network-byte order.