[Previous] [Contents] [Index] [Next]

ntohs()

Convert a 16-bit value from network-byte order to host-byte order

Synopsis:

#include <netinet/in.h>

in_port_t ntohs( in_port_t netshort );

Library:

socket3r.lib, socket3s.lib

Description:

The ntohs() function converts a 16-bit value from network-byte order to host-byte order. If a machine's byte order is the same as the network order, routines are defined as null macros.

This routine is most often used in conjunction with internet addresses and ports returned by gethostbyname() and getservent().

Returns:

The value in host-byte order.

Classification:

Standard Unix, POSIX 1003.1g (draft)

Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

gethostbyname(), getservent(), htonl(), htons(), ntohl()


[Previous] [Contents] [Index] [Next]