#include <sys/types.h> #include <netinet/in.h> unsigned short ntohs(unsigned short network_short)
#define _XOPEN_SOURCE 520 #include <netinet/in.h> uint16_t ntohs(uint16_t network_short)
The ntohs() function is used to convert a short (2-byte) integer from the standard network byte order to the local host byte order.
There are two versions of the API, as shown above. The base i5/OS API uses BSD 4.3 structures and syntax. The other uses syntax and structures compatible with the UNIX 98 programming interface specifications. You can select the UNIX 98 compatible interface with the _XOPEN_SOURCE macro.
No authorization is required.
ntohs() returns an integer. Possible values are:
On the iSeries server, the value returned to the caller is the same as the value that was passed to ntohs(), since the standard network byte order does not differ from the local host byte order.
Top | UNIX-Type APIs | APIs by category |