htons()

The htons() call translates a short integer from host byte order to network byte order.

#include <manifest.h>
#include <bsdtypes.h>
#include <in.h>
 
unsigned short htons(unsigned short a)
Parameter
Description
a
The unsigned short integer to be put into network byte order.

Return values

Returns the translated short integer.

Related calls

ntohs(), htonl(), ntohl()