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

NAME

12       htonl, htons, ntohl, ntohs - convert values between  host  and  network
13       byte order
14

SYNOPSIS

16       #include <arpa/inet.h>
17
18       uint32_t htonl(uint32_t hostlong);
19       uint16_t htons(uint16_t hostshort);
20       uint32_t ntohl(uint32_t netlong);
21       uint16_t ntohs(uint16_t netshort);
22
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(),   the   Base   Definitions   volume   of
59       IEEE Std 1003.1-2001, <inttypes.h>, <arpa/inet.h>
60
62       Portions of this text are reprinted and reproduced in  electronic  form
63       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
64       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
65       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
66       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
67       event of any discrepancy between this version and the original IEEE and
68       The Open Group Standard, the original IEEE and The Open Group  Standard
69       is  the  referee document. The original Standard can be obtained online
70       at http://www.opengroup.org/unix/online.html .
71
72
73
74IEEE/The Open Group                  2003                            HTONL(3P)
Impressum