1HTONL(3P)                  POSIX Programmer's Manual                 HTONL(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       htonl, htons, ntohl, ntohs — convert values between  host  and  network
14       byte order
15

SYNOPSIS

17       #include <arpa/inet.h>
18
19       uint32_t htonl(uint32_t hostlong);
20       uint16_t htons(uint16_t hostshort);
21       uint32_t ntohl(uint32_t netlong);
22       uint16_t ntohs(uint16_t netshort);
23

DESCRIPTION

25       These functions shall convert 16-bit and 32-bit quantities between net‐
26       work byte order and host byte order.
27
28       On some implementations, these functions are defined as macros.
29
30       The uint32_t and uint16_t types are defined in <inttypes.h>.
31

RETURN VALUE

33       The htonl() and htons() functions shall return the argument value  con‐
34       verted from host to network byte order.
35
36       The  ntohl() and ntohs() functions shall return the argument value con‐
37       verted from network to host byte order.
38

ERRORS

40       No errors are defined.
41
42       The following sections are informative.
43

EXAMPLES

45       None.
46

APPLICATION USAGE

48       These functions are most often used in conjunction with IPv4  addresses
49       and ports as returned by gethostent() and getservent().
50

RATIONALE

52       None.
53

FUTURE DIRECTIONS

55       None.
56

SEE ALSO

58       endhostent(), endservent()
59
60       The  Base  Definitions  volume  of  POSIX.1‐2008,  <arpa_inet.h>, <int‐
61       types.h>
62
64       Portions of this text are reprinted and reproduced in  electronic  form
65       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
66       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
67       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
68       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
69       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
70       event of any discrepancy between this version and the original IEEE and
71       The  Open Group Standard, the original IEEE and The Open Group Standard
72       is the referee document. The original Standard can be  obtained  online
73       at http://www.unix.org/online.html .
74
75       Any  typographical  or  formatting  errors that appear in this page are
76       most likely to have been introduced during the conversion of the source
77       files  to  man page format. To report such errors, see https://www.ker
78       nel.org/doc/man-pages/reporting_bugs.html .
79
80
81
82IEEE/The Open Group                  2013                            HTONL(3P)
Impressum