htonl, htons, ntohl, ntohs - convert values between host and network byte
Standard C Library (libc, -lc)
These routines convert 16 and 32 bit quantities between network byte
order and host byte order. The types in_addr_t and in_port_t are defined
by X/Open as:
typedef u_int32_t in_addr_t;
typedef u_int16_t in_port_t;
On machines which have a byte order which is the same as the network
order, routines are defined as null macros.
These routines are most often used in conjunction with Internet addresses
and ports as returned by gethostbyname(3) and getservent(3).
The byteorder functions appeared in 4.2BSD.
The `l' and `s' suffixes in the names are not meaningful in machines
where long integers are not 32 bits.
BSD June 4, 1993 BSD
[ Back ]