简体   繁体   中英

data is messed up when using boost::asio::async_write

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 overlapped. What can I do to avoid this happen?

Without code, it's a stab in the dark..

  1. Check that you are not using the same buffer for read/write operations
  2. If you are using async_xxx operations, ensure that they are not overlapped, ie you must never call async_read until the previous read completes and same for async_write
  3. You don't copy the data into the buffers correctly
  4. You've got a network issue
  5. Radiation from space is randomly modifying bits on the wire..

who knows...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM