*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> byteorder (3)              
Title
Content
Arch
Section
 

BYTEORDER(3)

Contents


NAME    [Toc]    [Back]

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

LIBRARY    [Toc]    [Back]

     Standard C Library (libc, -lc)

SYNOPSIS    [Toc]    [Back]

     #include <arpa/inet.h>

     or

     #include <netinet/in.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    [Toc]    [Back]

     These routines convert 16 and 32 bit quantities between network byte
     order and host byte order.  On machines which have a byte order which is
     the same as the network order, routines are defined as null macros.

     These routines are most often used in conjunction with Internet addresses
     and ports as returned by gethostbyname(3) and getservent(3).

SEE ALSO    [Toc]    [Back]

      
      
     gethostbyname(3), getservent(3)

STANDARDS    [Toc]    [Back]

     The byteorder functions conform to IEEE Std 1003.1-2001 (``POSIX.1'').

HISTORY    [Toc]    [Back]

     The byteorder functions appeared in 4.2BSD.

BUGS    [Toc]    [Back]

     On the VAX bytes are handled backwards from most everyone else in the
     world.  This is not expected to be fixed in the near future.


FreeBSD 5.2.1			 May 11, 2002			 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
htons Tru64 Convert an unsigned short (16-bit) integer from host byte order to network byte order
ntohl Tru64 Convert an unsigned 32-bit integer from Internet network byte order to host byte order
letoh16 OpenBSD convert values between different byte orderings
htons OpenBSD convert values between different byte orderings
htole64 OpenBSD convert values between different byte orderings
letoh32 OpenBSD convert values between different byte orderings
letoh64 OpenBSD convert values between different byte orderings
swap64 OpenBSD convert values between different byte orderings
ntohs OpenBSD convert values between different byte orderings
ntohl OpenBSD convert values between different byte orderings
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service