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)
Returns the translated short integer.
ntohs(), htonl(), ntohl()