A client and a server exchange one byte data soon after the communication has started as follows.
The one byte data is 0, 1 or 0xFF. 0 means that one wants to use the network byte order to send 16 or 32bit quantities. 1 means that one wants to use the little endian order. 0xFF means that one wants to use the big endian order. On each side, if the preference coincides with each other then the byte order is used. Otherwise the network byte order is used.
If a system implements only the network byte order, then it is sufficient to send always 0. However unnecessary byte order conversion may add large overhead and it is often a bottle-neck on fast networks.
#define OX_BYTE_NETWORK_BYTE_ORDER 0 #define OX_BYTE_LITTLE_ENDIAN 1 #define OX_BYTE_BIG_ENDIAN 0xff