Converts an unsigned short integer from Internet network byte order to host byte order.
ISODE Library (libisode.a)
#include <sys/types.h> #include <netinet/in.h>
unsigned short ntohs ( NetShort)
unsigned short NetShort;
The ntohs subroutine converts an unsigned short (16-bit) integer from Internet network byte order to the host byte order.
Receiving hosts require Internet addresses and ports in host byte order. Use the ntohs subroutine to convert Internet addresses and ports to the host integer representation.
The ntohs subroutine is defined in the net/nh.h file as a macro.
All applications containing the ntohs subroutine must be compiled with _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.
NetShort | Requires a 16-bit integer in network standard byte order. |
The ntohs subroutine returns the supplied integer in host byte order.
The endhostent subroutine, endservent subroutine, gethostbyaddr subroutine, gethostbyname subroutine, getservbyname subroutine, getservbyport subroutine, getservent subroutine, htonl subroutine, htons subroutine, ntohl subroutine, sethostent subroutine, setservent subroutine.
Sockets Overview in AIX 5L Version 5.2 Communications Programming Concepts.