I have a coap server code running on my gateway which may have x86 or ARM architecture, which sends a Buffer to coap client in another hardware which may have x86 or ARM architecture, my question is, on a specific scenario where the client has x86 architecture and the server has ARM architecture, when the buffer is written by the server and the client parses the payload buffer will occur an uncompatibility, consequently an error?
obs: I ask this because x86 architecture is little-endian and the ARM architecture is Big-endian.
To exchange raw binary data between systems of possibly different architectures, the data has to be put into a known canonical format. The sender has to make sure it's in that known format and the recipient has to expect it in that known format.
For some things that's easy. If it's merely an array of U8 values (unsigned 8-bit values), then that is already a known, canonical format.
But, if it's an array of U16, U32, U64, S16, S32, S64 values or any type of format containing those larger values, then you have to know if it's in big endian or little endian byte format. You will need to decide what the interchange format is and make sure you put the data into that format before sending and the recipient needs to accept the data in that format, perhaps converting it into what it wants to use natively.
So, you can't just blindly send multi-byte data from a little endian architecture to a big endian architecture without converting it. It is best to decide upon a specific interchange format, have the sender of the data make sure the data is converted to that interchange format and make sure the recipient is expecting the data in that interchange format.
FYI, for modest amounts of data, this is why non-binary formats like JSON exist and have become so popular because they are already a well-known standard that doesn't have endian ordering issues.