next up previous contents
: An example of launcher : How to start a : Launcher   ܼ


Negotiation of the byte order

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.

In order to send and receive 64 bit machine double (floating point number) and 128 bit machine double, we use the same byte order. In other words, we cast double64 * to int32 * and send the array of 4 bytes by the same method with sending int32. As to examples, see the section on CMO_64BIT_MACHINE_DOUBLE.

#define OX_BYTE_NETWORK_BYTE_ORDER    0
#define OX_BYTE_LITTLE_ENDIAN         1
#define OX_BYTE_BIG_ENDIAN         0xff


next up previous contents
: An example of launcher : How to start a : Launcher   ܼ
Nobuki Takayama Heisei 28.8.27.