byteorder(3) - NetBSD Manual Pages

Command: Section: Arch: Collection:  
BYTEORDER(3)              NetBSD Programmer's Manual              BYTEORDER(3)


NAME
htonl, htons, ntohl, ntohs - convert values between host and network byte order
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <sys/types.h> in_addr_t htonl(in_addr_t host32); in_port_t htons(in_port_t host16); in_addr_t ntohl(in_addr_t net32); in_port_t ntohs(in_port_t net16);
DESCRIPTION
These routines convert 16 and 32 bit quantities between network byte or- der 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 or- der, 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).
SEE ALSO
gethostbyname(3), getservent(3)
HISTORY
The byteorder functions appeared in 4.2BSD.
BUGS
The `l' and `s' suffixes in the names are not meaningful in machines where long integers are not 32 bits. NetBSD 1.6 June 4, 1993 1
Powered by man-cgi (2024-03-20). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.