htons(3)


NAME

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

SYNOPSIS

   #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

   The htonl() function converts the unsigned integer hostlong  from  host
   byte order to network byte order.

   The htons() function converts the unsigned short integer hostshort from
   host byte order to network byte order.

   The ntohl() function converts the unsigned integer netlong from network
   byte order to host byte order.

   The  ntohs() function converts the unsigned short integer netshort from
   network byte order to host byte order.

   On the i386 the host  byte  order  is  Least  Significant  Byte  first,
   whereas  the  network  byte  order,  as  used  on the Internet, is Most
   Significant Byte first.

ATTRIBUTES

   For  an  explanation  of  the  terms  used   in   this   section,   see
   attributes(7).

   ┌───────────────────────────────────┬───────────────┬─────────┐
   │InterfaceAttributeValue   │
   ├───────────────────────────────────┼───────────────┼─────────┤
   │htonl(), htons(), ntohl(), ntohs() │ Thread safety │ MT-Safe │
   └───────────────────────────────────┴───────────────┴─────────┘

CONFORMING TO

   POSIX.1-2001, POSIX.1-2008.

   Some  systems  require  the  inclusion  of  <netinet/in.h>  instead  of
   <arpa/inet.h>.

SEE ALSO

   bswap(3), endian(3), gethostbyname(3), getservent(3)

COLOPHON

   This page is part of release 4.09 of the Linux  man-pages  project.   A
   description  of  the project, information about reporting bugs, and the
   latest    version    of    this    page,    can     be     found     at
   https://www.kernel.org/doc/man-pages/.


More Linux Commands

manpages/enc2xs.1.html
enc2xs(1) - Perl Encode Module Generator - Linux man page...
enc2xs builds a Perl extension for use by Encode from either Unicode Character Mapping files (.ucm) or Tcl Encoding Files (.enc). Besides being used internally

manpages/SDL_CD.3.html
SDL_CD(3) - CDROM Drive Information - Linux manual page.....
An SDL_CD structure is returned by SDL_CDOpen. It represents an opened CDROM device and stores information on the layout of the tracks on the disc. A frame is t

manpages/perldos.1.html
perldos(1) - Perl under DOS, W31, W95. - Linux manual page
Before you start, you should glance through the README file found in the top-level directory where the Perl distribution was extracted. Make sure you read and u

manpages/ntptime.8.html
ntptime(8) read kernel time variables - Linux manual page...
This program is useful only with special kernels described in the A Kernel Model for Precision Timekeeping page. It reads and displays time-related kernel varia

manpages/gtk3-icon-browser.1.html
gtk3-icon-browser(1) List themed icons - Linux manual page
gtk3-icon-browswer is a utility to explore the icons in the current icon theme. It shows icons in various sizes, their symbolic variants where available, as wel

manpages/libreoffice.1.html
libreoffice(1) - LibreOffice office suite - Linux man page
LibreOffice (LO for short) is a multi-platform office productivity suite. It was derived from OpenOffice.org 3.3 Beta on September 28, 2010. libreoffice is a sh

manpages/Tcl_Sleep.3.html
Tcl_Sleep(3) - delay execution for a given number of millise
This procedure delays the calling process by the number of milliseconds given by the ms parameter and returns after that time has elapsed. It is typically used

manpages/slk_refresh_sp.3ncurses.html
slk_refresh_sp(3ncurses) - curses screen-pointer extension
This implementation can be configured to provide a set of functions which improve the ability to manage multiple screens. This feature can be added to any of th

manpages/inet_makeaddr.3.html
inet_makeaddr(3) - Internet address manipulation routines...
inet_aton() converts the Internet host address cp from the IPv4 numbers-and-dots notation into binary form (in network byte order) and stores it in the structur

manpages/XSetWMHints.3.html
XSetWMHints(3) - allocate window manager hints structure and
XSetWMHints.3 - The XAllocWMHints function allocates and returns a pointer to a XWMHints structure. Note that all fields in the XWMHints structure are initially

manpages/JSON::PP::Boolean.3pm.html
JSON::PP::Boolean(3pm) - dummy module providing JSON::PP::Bo
This module exists only to provide overload resolution for Storable and similar modules. See JSON::PP for more info about this class. AUTHOR This idea is from J

manpages/LWP::Simple.3pm.html
LWP::Simple(3pm) - simple procedural interface to LWP.......
This module is meant for people who want a simplified view of the libwww-perl library. It should also be suitable for one-liners. If you need more control or ac





We can't live, work or learn in freedom unless the software we use is free.