The htons function converts a u_short from host to TCP/IP network byte order (which is big-endian).
u_short htons( u_short hostshort );
int htons(int hostshort) => _htons(hostshort);