byteorder(3N)
Requires Optional LAN/X.25 Software
NAME
htonl, htons, ntohl, ntohs − convert values between host and network byte order
SYNOPSIS
#include <netinet/in.h>
unsigned long htonl(unsigned long hostlong);
unsigned short htons(unsigned short hostshort);
unsigned long ntohl(unsigned long netlong);
unsigned short ntohs(unsigned short netshort);
DESCRIPTION
These routines convert 16- and 32-bit quantities between network byte order and host byte order. On HP-UX systems, network and host byte orders are identical, so these routines are defined as null macros in the include file <netinet/in.h>.
These routines are most often used in conjunction with Internet addresses and ports as returned by gethostent(3N) and getservent(3N). Use these routines to write portable programs.
AUTHOR
byteorder was developed by the University of California, Berkeley.
SEE ALSO
gethostent(3N), getservent(3N).
Hewlett-Packard Company — HP-UX Release 8.05: June 1991