byteorder(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).

   
   Interface                           Attribute      Value   
   
   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/systemd-hostnamed.8.html
systemd-hostnamed(8) Host name bus mechanism (Man Page).....
systemd-hostnamed is a system service that may be used as a mechanism to change the systems hostname. systemd-hostnamed is automatically activated on request an

manpages/XBaseFontNameListOfFontSet.3.html
XBaseFontNameListOfFontSet(3) - obtain fontset information
The XFontsOfFontSet function returns a list of one or more XFontStructs and font names for the fonts used by the Xmb and Xwc layers for the given font set. A li

manpages/Tcl_ExprDouble.3.html
Tcl_ExprDouble(3) - evaluate an expression - Linux man page
These four procedures all evaluate the expression given by the expr argument and return the result in one of four different forms. The expression can have any o

manpages/XIDeleteProperty.3.html
XIDeleteProperty(3) - change, retrieve or delete a device's
The XIGetProperty function returns the actual type of the property; the actual format of the property; the number of 8-bit, 16-bit, or 32-bit items transferred;

manpages/safe_loadTk.n.html
safe_loadTk(n) Load Tk into a safe interpreter. (Man Page)
Safe Tk is based on Safe Tcl, which provides a mechanism that allows restricted and mediated access to auto-loading and packages for safe interpreters. Safe Tk

manpages/gnutls_pkcs11_copy_x509_crt.3.html
gnutls_pkcs11_copy_x509_crt(3) - API function (Man Page)....
This function will copy a certificate into a PKCS 11 token specified by a URL. The certificate can be marked as trusted or not. RETURNS On success, GNUTLS_E_SUC

manpages/default_colors.3ncurses.html
default_colors(3ncurses) - use terminal's default colors....
The use_default_colors() and assume_default_colors() functions are extensions to the curses library. They are used with terminals that support ISO 6429 color, o

manpages/xauth.1.html
xauth(1) - X authority file utility - Linux manual page.....
The xauth program is used to edit and display the authorization information used in connecting to the X server. This program is usually used to extract authoriz

manpages/grub2-kbdcomp.1.html
grub2-kbdcomp(1) generate a GRUB keyboard layout file.......
grub-kbdcomp processes a X keyboard layout description in keymaps(5) format into a format that can be used by GRUBs keymap command. Make GRUB keyboard layout fi

manpages/gluNurbsProperty.3gl.html
gluNurbsProperty(3gl) - set a NURBS property (Man Page).....
gluNurbsProperty is used to control properties stored in a NURBS object. These properties affect the way that a NURBS curve is rendered. The accepted values for

manpages/Xcomposite.3.html
Xcomposite(3) - X Composite Extension library (Man Page)....
The composite extension provides several related mechanisms: Per-hierarchy storage The rendering of an entire hierarchy of windows is redirected to off-screen s

manpages/geometry.n.html
geometry(n) - Geometrical computations - Linux manual page
The following Tcl variables are either set or used by Tk at various times in its execution: tk_library This variable holds the file name for a directory contain





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