Sign in to follow this  

sending binary packet vs. struct?

This topic is 3837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What are the advantages of sending binary packets rather than structs with the same data?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites

This topic is 3837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this