Marc Roessler
|
Endianness conversion .. done automatically?
|
Marc Roessler
05/28/2009 10:08 AM
post30236
|
Endianness conversion .. done automatically?
Hi guys,
when using QNet to communicate between CPUs of differing endianness,
which endianness conversions are done automatically and which must I do myself?
As an example:
I want to send a proprietary message to the server. I build that message:
reg_msg.io_msg_hdr.type = _IO_MSG;
reg_msg.io_msg_hdr.combine_len = ...;
reg_msg.io_msg_hdr.mgrid = _IOMGR_IO_...;
reg_msg.io_msg_hdr.subtype = ...;
Those values are all uint16, so they need conversion.
This means that the Framework will convert these values, otherwise I couldn't check for the type on the destination CPU
- correct? What about mgrid and subtype, are those converted as well?
What about registering and sending Pulses...?
I initialize the pulse using SIGEV_PULSE_INIT() and send it to the Server using MsgSend() with a special message type
(proprietary). The pulse code will be the same on both CPUs, as it is 8 bits, so no problems with the endianness here.
What about the pulse value? Will it be swapped by the MsgDeliverEvent()? Usually it doesn't matter because the value has
been set by the client before sending the event to the server. But in our case we need to modify the value in the
server. Will it be automatically endianness swapped when sending the pulse to the client?
Thanks & Greetings,
Marc
|
|
|