Functions to convert between Host and Network TCP/IP formats.
network-long = htonl (host-long)
network-short = htons (host-short)
host-long = ntohl (network-long)
host-short = ntohs (network-short)
network-long | : A 32-bit number in TCP/IP network byte order. |
network-short | : A 16-bit number in TCP/IP network byte order. |
host-long | : A 32-bit number in host byte order. |
host-short | : A 16-bit number in host byte order. |
The Windows Sockets functions convert between Host (Little Endian) values and Network TCP/IP (Big Endian) values.
Local h% = 10444887 // Host Value
Local n% = htonl(h%) // TCP/IP Value
Trace Bin(h%, 32) // Little Endian (low byte first)
Trace Bin(n%, 32) // Big Endian (high byte first)
Debug.Show
{Created by Sjouke Hamstra; Last updated: 16/01/2023 by James Gaite; Other Contributors: Jean-Marie Melanson}