1BYTEORDER(3)               Linux Programmer's Manual              BYTEORDER(3)
2
3
4

NAME

6       htonl,  htons,  ntohl,  ntohs - convert values between host and network
7       byte order
8

SYNOPSIS

10       #include <arpa/inet.h>
11
12       uint32_t htonl(uint32_t hostlong);
13
14       uint16_t htons(uint16_t hostshort);
15
16       uint32_t ntohl(uint32_t netlong);
17
18       uint16_t ntohs(uint16_t netshort);
19

DESCRIPTION

21       The htonl() function converts the unsigned integer hostlong  from  host
22       byte order to network byte order.
23
24       The htons() function converts the unsigned short integer hostshort from
25       host byte order to network byte order.
26
27       The ntohl() function converts the unsigned integer netlong from network
28       byte order to host byte order.
29
30       The  ntohs() function converts the unsigned short integer netshort from
31       network byte order to host byte order.
32
33       On the i386 the host  byte  order  is  Least  Significant  Byte  first,
34       whereas  the  network byte order, as used on the Internet, is Most Sig‐
35       nificant Byte first.
36

CONFORMING TO

38       POSIX.1-2001.
39
40       Some  systems  require  the  inclusion  of  <netinet/in.h>  instead  of
41       <arpa/inet.h>.
42

SEE ALSO

44       endian(3), gethostbyname(3), getservent(3)
45

COLOPHON

47       This  page  is  part of release 3.22 of the Linux man-pages project.  A
48       description of the project, and information about reporting  bugs,  can
49       be found at http://www.kernel.org/doc/man-pages/.
50
51
52
53GNU                               2009-01-15                      BYTEORDER(3)
Impressum