Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
byteorder(3SOCKET)	   Sockets Library Functions	    byteorder(3SOCKET)

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

SYNOPSIS
       #include	<sys/types.h>
       #include	<netinet/in.h>
       #include	<inttypes.h>

       uint32_t	htonl(unint32_t	hostlong);

       uint16_t	htons(uint16_t hostshort);

       uint32_t	ntohl(uint32_t netlong);

       uint16_t	ntohs(uint16_t netshort);

DESCRIPTION
       These routines convert 16 and 32	bit quantities	between	 network  byte
       order and host byte order. On some architectures	these routines are de-
       fined as	NULL macros in the include file	<netinet/in.h>.	On  other  ar-
       chitectures,  if	 their	host byte order	is different from network byte
       order, these routines are functional.

       These routines are most often used in  conjunction  with	 Internet  ad-
       dresses	and  ports  as	returned by gethostent() and getservent(). See
       gethostbyname(3NSL) and getservbyname(3SOCKET).

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       +-----------------------------+-----------------------------+
       |      ATTRIBUTE	TYPE	     |	    ATTRIBUTE VALUE	   |
       +-----------------------------+-----------------------------+
       |MT-Level		     |Safe			   |
       +-----------------------------+-----------------------------+

SEE ALSO
       gethostbyname(3NSL), getservbyname(3SOCKET), attributes(5), inet(3HEAD)

SunOS 5.9			  21 Oct 1997		    byteorder(3SOCKET)

NAME | SYNOPSIS | DESCRIPTION | ATTRIBUTES | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=htonl&sektion=3socket&manpath=SunOS+5.9>

home | help