ntohs: Translate a short integer

The ntohs socket function translates a short integer from network byte order to host byte order.

Last updated

Added for PUT00.

Format

#include  <sys/types.h>
#include  <sys/socket.h>
u_short   ntohs(u_short a);
a
Unsigned short integer to be put into host byte order.

Normal return

Returns the translated short integer.

Error return

None.

Programming considerations

None.

Examples

The following example converts the information from network byte order to host byte order.
#include <sys/types.h>
#include <sys/socket.h>
⋮
u_short a;
u_short n;
⋮
ntohs(a);

Related information