when I was using boost::asio::async_write to send some large data, I found the data I received was messed up, but total size was correct. it seemed like two groups of data ove开发者_运维百科rlapped. What can I do to avoid this happen?
Without code, it's a stab in the dark..
- Check that you are not using the same buffer for read/write operations
- If you are using async_xxx operations, ensure that they are not overlapped, i.e. you must never call
async_read
until the previous read completes and same forasync_write
- You don't copy the data into the buffers correctly
- You've got a network issue
- Radiation from space is randomly modifying bits on the wire..
who knows...
精彩评论