Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

hton(3) [minix man page]

HTON(3) 						     Library Functions Manual							   HTON(3)

NAME
hton, htons, htonl, ntohs, ntohl - host to network byte order conversion SYNOPSIS
#define _MINIX_SOURCE 1 #include <stddef.h> #include <sys/types.h> #include <net/hton.h> u16_t htons(u16_t host_word) u32_t htonl(u32_t host_dword) u16_t ntohs(u16_t network_word) u32_t ntohl(u32_t network_dword) u16_t HTONS(u16_t host_word) u32_t HTONL(u32_t host_dword) u16_t NTOHS(u16_t network_word) u32_t NTOHL(u32_t network_dword) DESCRIPTION
These macros convert 16-bit and 32-bit quantities to and from the network byte order used by the TCP/IP protocols. The function of the macros is encoded in their name. H means host byte order, n means network byte order, s means a 16-bit quantity and l means a 32-bit quan- tity. Thus htons converts a 16-bit quantity from host byte order to network byte order. The difference between the lower case and upper case variants is that the lower case variants evaluate the argument at most once and the upper case variants can be used for constant fold- ing. That is, htonl(f(x)) will call f(x) at most once and HTONS(0x10) will be equivalent to 0x10 on a big-endian machine and 0x1000 on a little-endian machine. SEE ALSO
ip(4). AUTHOR
Philip Homburg (philip@cs.vu.nl) HTON(3)

Check Out this Related Man Page

htonl(3XNET)					   X/Open Networking Services Library Functions 				      htonl(3XNET)

NAME
htonl, htons, ntohl, ntohs - convert values between host and network byte order SYNOPSIS
cc [ flag ... ] file ... -lxnet [ library ... ] #include <arpa/inet.h> uint32_t htonl(uint32_t hostlong); uint16_t htons(uint16_t hostshort); uint32_t ntohl(uint32_t netlong); uint16_t ntohs(uint16_t netshort); DESCRIPTION
These functions convert 16-bit and 32-bit quantities between network byte order and host byte order. The uint32_t and uint16_t types are made available by inclusion of <inttypes.h>. USAGE
These functions are most often used in conjunction with Internet addresses and ports as returned by gethostent(3XNET) and getser- vent(3XNET). On some architectures these functions are defined as macros that expand to the value of their argument. RETURN VALUES
The htonl() and htons() functions return the argument value converted from host to network byte order. The ntohl() and ntohs() functions return the argument value converted from network to host byte order. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
endhostent(3XNET), endservent(3XNET), attributes(5), standards(5) SunOS 5.10 10 Jun 2002 htonl(3XNET)
Man Page