|HTONL(3)||Library Functions Manual||HTONL(3)|
convert values between host and network byte
These routines convert 16 and 32-bit quantities between different byte orderings.
htons() functions convert quantities from host to
network byte order while the
ntohs() functions convert in the other
The last letter (‘s’ or ‘l’) is a
mnemonic for the traditional names for such quantities,
respectively. Today, the C concept of
long integers need not coincide with this
traditional misunderstanding. On machines which have a byte order which is
the same as the network order, routines are defined as null macros.
ntohs() functions conform to IEEE
Std 1003.1 (“POSIX.1”).
These functions appeared in 4.2BSD.
On the alpha, amd64, i386, and some mips and arm architectures, bytes are handled backwards from most everyone else in the world. This is not expected to be fixed in the near future.
|February 13, 2019||OpenBSD-current|