htonl, htons - General: Convert word and longword values
from host-to-network byte order
#include <sys/param.h>
unsigned int htonl(
unsigned int longword ); unsigned short htons(
unsigned short word );
Specifies a 32-bit value to be conditionally byte swapped.
Specifies a 16-bit value to be conditionally byte swapped.
The htonl routine converts the specified longword value
from host-to-network byte order. The htons routine converts
the specified word value from host-to-network byte
order.
The TCP/IP protocols specify the canonical network byte
order, which is big endian (meaning that the most significant
byte is leftmost in memory).
Upon successful completion, the htonl routine returns the
converted longword value in network byte order. Similarly,
upon successful completion, the htons routine converts the
specified word value in network byte order.
Routines: ntohl(9r)
htonl(9r)
[ Back ] |