Host Byte Order / Network Byte Order

The byte order is fixed in network protocols. This is called the Network Byte Order. The natural byte order in the TwinCAT system is called the Host Byte Order. In most cases, the required Network Byte Order corresponds to the Big Endian Format (MOTOROLA). However, the TwinCAT PLC system uses the Little Endian Format (Intel). So that the error-free exchange of data between the TwinCAT PLC system and a different platform can take place, the byte order in the application program must be converted accordingly.

Data that is to be transmitted via a network protocol from the TwinCAT system (host) to an external system can be converted to the network format using the following functions:

Conversely, the received network data (external system) can be converted to the host format (TwinCAT system) using the following functions: