htonl(3) — Subroutines
OSF
NAME
htonl − Converts an unsigned long (32-bit) integer from host-byte order to Internet network-byte order
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <netinet/in.h> unsigned long hostlong) ;
PARAMETERS
hostlongSpecifies a 32-bit integer in host-byte order.
DESCRIPTION
The htonl() (host-to-network long) function converts an unsigned long (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 long integers from Internet host-byte order to Internet network-byte ordered long 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 long integer in Internet network-byte order.