![]() Chapter Contents |
![]() Previous |
![]() Next |
| htons |
| Portability: | UNIX compatible |
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| CAUTION | |
| PORTABILITY | |
| IMPLEMENTATION | |
| RELATED FUNCTIONS |
| SYNOPSIS |
#include <sys/types.h> #include <netinet/in.h> unsigned short htons(unsigned short hostshort);
| DESCRIPTION |
The
htons
macro converts an unsigned short integer
hostshort
from host byte order to network byte
order. On an IBM 370, this is a null macro since IBM 370 byte ordering is
big endian, as is network byte ordering.
| RETURN VALUE |
htons
returns the converted value.
| CAUTION |
There is also an
htons
function. Be sure to include the proper
header files so that the
htons
macro is always used.
| PORTABILITY |
htons
is portable to other environments, including most UNIX systems,
that implement BSD sockets.
| IMPLEMENTATION |
The
htons
macro is defined in the
<netinet/in.h>
header file.
| RELATED FUNCTIONS |
htoncs
,
htonl
,
ntohcs
,
ntohs
,
ntohl
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.