1HTONL(P)                   POSIX Programmer's Manual                  HTONL(P)
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       uint16_t htons(uint16_t hostshort);
14       uint32_t ntohl(uint32_t netlong);
15       uint16_t ntohs(uint16_t netshort);
16
17

DESCRIPTION

19       These functions shall convert 16-bit and 32-bit quantities between net‐
20       work byte order and host byte order.
21
22       On some implementations, these functions are defined as macros.
23
24       The uint32_t and uint16_t types are defined in <inttypes.h>.
25

RETURN VALUE

27       The  htonl() and htons() functions shall return the argument value con‐
28       verted from host to network byte order.
29
30       The ntohl() and ntohs() functions shall return the argument value  con‐
31       verted from network to host byte order.
32

ERRORS

34       No errors are defined.
35
36       The following sections are informative.
37

EXAMPLES

39       None.
40

APPLICATION USAGE

42       These  functions are most often used in conjunction with IPv4 addresses
43       and ports as returned by gethostent() and getservent().
44

RATIONALE

46       None.
47

FUTURE DIRECTIONS

49       None.
50

SEE ALSO

52       endhostent()  ,  endservent()  ,  the  Base   Definitions   volume   of
53       IEEE Std 1003.1-2001, <inttypes.h>, <arpa/inet.h>
54
56       Portions  of  this text are reprinted and reproduced in electronic form
57       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
58       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
59       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
60       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
61       event of any discrepancy between this version and the original IEEE and
62       The  Open Group Standard, the original IEEE and The Open Group Standard
63       is the referee document. The original Standard can be  obtained  online
64       at http://www.opengroup.org/unix/online.html .
65
66
67
68IEEE/The Open Group                  2003                             HTONL(P)
Impressum