P
pramod
Two differenet applications (running on different OS, different
compilers) are communicating thru protocol consisting of functions and
arguments.
Communication link can be TCP/IP, or serial port.
What is the best way to map structure instance to protocol messages ?
The solutions we are thinking of -
1. declare each structure member as packed, and use memcpy for struct
size.
The target application should directly memcpy this area, to the
desired structure, which is already instantiated.
2. serialize each entry with member data type, followed by value, and
transmit it over link.
Value needs to be decoded using data type flag.
1st option might not be portable.
2nd option requires extra efforts and overhead.
Is there any better alternative?
regards,
Pramod
compilers) are communicating thru protocol consisting of functions and
arguments.
Communication link can be TCP/IP, or serial port.
What is the best way to map structure instance to protocol messages ?
The solutions we are thinking of -
1. declare each structure member as packed, and use memcpy for struct
size.
The target application should directly memcpy this area, to the
desired structure, which is already instantiated.
2. serialize each entry with member data type, followed by value, and
transmit it over link.
Value needs to be decoded using data type flag.
1st option might not be portable.
2nd option requires extra efforts and overhead.
Is there any better alternative?
regards,
Pramod