I want to send raw ints with boost.asio compatibly with any CPU architecture. Usually, I would convert ints to strings, but I may be able to get better performance by skipping the int/ascii conversion. I don't know what boost.asio already does under the hood such as using htonl. The documentation doesn't say and there is no way to test this code  on my own PC.
Here are several methods I have to send an array of ints over the network:
- Store the 
ints in an array ofint32_t. Usehtonlandntohlto get correct endian-ness. Ifint32_tis not supported on the target machine, handle that withint_fast32_tand extra work. - Use boost.serialization. The only example I can find is from pre-C++11 times (see section on serialization), so I don't know if boost.serialization and boost.asio should still be used in this way. Also, as boost.serialization is a black box, it isn't clear what the performance overhead of using this library is.
 - Convert each int to the ascii representation.
 
I think (1) is the "correct" alternative to non-ascii conversion. Can boost.asio or boost.serialization perform any of the steps of (1) for me? If not, what is the current recommended way to send ints with boost.asio?