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

  man pages->NetBSD man pages -> htons (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 <sys/types.h>

     in_addr_t
     htonl(in_addr_t host32);

     in_port_t
     htons(in_port_t host16);

     in_addr_t
     ntohl(in_addr_t net32);

     in_port_t
     ntohs(in_port_t net16);

DESCRIPTION    [Toc]    [Back]

     These routines convert 16 and 32 bit quantities between network byte
     order and host byte order. The types in_addr_t and in_port_t are defined
     by X/Open as:

           typedef u_int32_t in_addr_t;
           typedef u_int16_t in_port_t;

     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)

HISTORY    [Toc]    [Back]

     The byteorder functions appeared in 4.2BSD.

BUGS    [Toc]    [Back]

     The `l' and `s' suffixes in the names are not meaningful in machines
     where long integers are not 32 bits.

BSD                              June 4, 1993                              BSD
[ 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