Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c++ network serialization [closed]

I'm looking for a solution for serializing of c++ packets to a network stream.

I have seen many posts here refering people to:

  1. ACE

  2. Google Protocol Buffers

  3. Boost::Serialization

  4. Qt ::QDataStream

My Requirements/ Constraints:

  1. The solution must be unaware of LitteEndian/BigEndian. Machine Architecture x86/x64 and platform independant.

  2. The foot print (RAM & ROM) of the first 3 solution are too big for my platform,and the fourth is conflicting with the next requirement.

  3. The solution won't require a lot of boilerplate code (there will be 200+ packet to be serialized).

Thanks, Koby Meir

like image 796
koby meir Avatar asked Apr 11 '11 15:04

koby meir


1 Answers

If you find that Google Protocol Buffers are to heavy (I can agree with that because compiled library could take more than 1 MB), you could try the lite version of protobuf which is a few times smaller. It can be enabled in *.proto files by inserting the following line

option optimize_for = LITE_RUNTIME;

But if you need a protobuf solution with minimal overhead I would go with protobuf-c,
a C implementation of protobuf. It will be a little harder to use, but binary code size overhead should be minimal (30-50 KB). I know that this C implementation is used for example by umurmur - a voice server that runs very well on embedded Linux ARM and MIPS routers.

like image 175
Zuljin Avatar answered Oct 05 '22 09:10

Zuljin