htonl, htons, ntohl, ntohs
Purpose
Convert values between host and Internet network byte
order.
Library
Sockets Library (libsock.a)
Syntax
#include <sys/types.h>
#include <netinet/in.h>
unsigned long htonl (hostlong) unsigned long ntohl (netlong)
unsigned long hostlong; unsigned long netlong;
unsigned short htons (hostshort) unsigned short ntohs (netshort)
unsigned short hostshort; unsigned short netshort;
Description
These subroutines convert 16- and 32-bit quantities
between network byte order and host byte order.
These subroutines are often used in conjunction with
Internet addresses and ports as returned by the
gethostent and getservent subroutines.
Related Information
In this book: " gethostbyaddr, gethostbyname,
sethostent, endhostent .*5a, gethostent" and "getservent,
getservbyname, getservbyport, setservent, endservent."