sending binary packet vs. struct?

Started by
3 comments, last by Ramsess 16 years, 9 months ago
What are the advantages of sending binary packets rather than structs with the same data?
Advertisement
What distinction are you making between the two? Can you give a little example?
You only use structs for IPC on the same machine, when communicating within a codebase compiled on the same compiler using same libraries.

Another possible use for structs would be within very controlled and absolutely performance critical systems, where you have full control over all hardware and OS used.

When sending over the network, you always explicitly serialize. Always. Or you're building a time bomb.

Ok I understand now thanks for the help.
If you a compiled and same OS & hardware .. no problem.
In another ways you will get problem:
1) struct aligment -> size my be not equals
2) byte ordered for data ( same binnary data on Intel and PowerPC not be equals)

This topic is closed to new replies.

Advertisement