Chapter Contents

Previous

Next
ntohs

ntohs



Converts a Short Integer from Network to Host Byte Order

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
PORTABILITY
IMPLEMENTATION
RELATED FUNCTIONS


SYNOPSIS

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

unsigned short ntohs(unsigned short netshort);


DESCRIPTION

The ntohs macro converts an unsigned short integer netshort from network byte order to host 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

ntohs returns the converted value.


CAUTION

There is also an ntohs function. Be sure to include the proper header files so that the ntohs macro is always used.


PORTABILITY

ntohs is portable to other environments, including most UNIX systems, that implement BSD sockets.


IMPLEMENTATION

The ntohs macro is defined in the <netinet/in.h> header file.


RELATED FUNCTIONS

htoncs , htonl , htons , ntohcs , ntohl


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.