Skip to content

net.conv #

Description:

net.conv provides a convenient way to convert number values to, and from the network byte order format (which is always big endian).

When communicating across a network, it is possible that the machines use different byte orders, since the host format of each system can vary, depending on the CPU, and on most systems, is usually little endian.

To avoid mismatches due to that, the network byte order is used by convention to send network data in a manner that will be received coherently, regardless of the endianness of the sender system and the receiver system.

fn htn16 #

fn htn16(host u16) u16

htn16 converts the 16 bit value host to the net format (htons)

fn htn32 #

fn htn32(host u32) u32

htn32 converts the 32 bit value host to the net format (htonl)

fn htn64 #

fn htn64(host u64) u64

htn64 converts a the 64 bit value host to the net format (htonll)

fn nth16 #

fn nth16(net u16) u16

nth16 converts the 16 bit value net to the host format (ntohs)

fn nth32 #

fn nth32(net u32) u32

nth32 converts the 32 bit value net to the host format (ntohl)

fn nth64 #

fn nth64(net u64) u64

nth64 converts the 64 bit value net to the host format (ntohll)