Sockets Library Functions byteorder(3SOCKET)
NAME
byteorder, htonl, htonll, htons, ntohl, ntohll, ntohs - con-
vert values between host and network byte order
SYNOPSIS
cc [ flag... ] file... -lsocket -lnsl [ library... ]
#include
#include
#include
uint32t htonl(uint32t hostlong);
uint64t htonll(uint64t hostlonglong);
uint16t htons(uint16t hostshort);
uint32t ntohl(uint32t netlong);
uint64t ntonll(uint64t hostlonglong);
uint16t ntohs(uint16t netshort);
DESCRIPTION
These functions convert 16-bit, 32-bit, and 64-bit quanti-
ties between network byte order and host byte order. On some
architectures these routines are defined as NUL macros in
the include file . On other architectures, the
routines are functional when the host byte order is dif-
ferent from network byte order.
These functions are most often used in conjunction with
Internet addresses and ports as returned by gethostent() and
getservent(). See gethostbyname(3NSL) and
getservbyname(3SOCKET).
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 10 Sep 2008 1
Sockets Library Functions byteorder(3SOCKET)
ATRIBUTE TYPE ATRIBUTE VALUE
MT-Level Safe
SEE ALSO
gethostbyname(3NSL), getservbyname(3SOCKET), inet.h(3HEAD),
attributes(5)
SunOS 5.11 Last change: 10 Sep 2008 2
|