c++ - Byte representation - Network raw data -


i'm little confused on following network analogy:

consider i'm serializing structure (with integers) passing pointer winsock send() function.

these 4byte integers on intel machine may represented in different way on big endian machine , misinterpreted when structure recreated on other side.

that's understandable, problem - wondering - if both programs run on both machines compiled 32bit? wouldn't automatic conversion occur intel <-> amd instruction set happens binary files?

if there's no way avoid - how work sending raw data structures on network without having problem?

you should choose network format data , specify every byte in format (e.g. may use big-endian 4 bytes representation integers), , write converters to/from format each kind of platform program runs at.

the 32/64-bits, instruction sets, intel/amd differences have nothing this.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -