htons

public func htons(UInt16) -> UInt16

Wraps htons(3) — host-to-network byte order for 16-bit values.

On little-endian hosts this swaps the byte order; on big-endian hosts it is the identity. Use to convert a port number before writing it into a sockaddr_in.sin_port field.

Defined in lang/std/net/libc.ks