开发者

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

开发者 https://www.devze.com 2023-01-31 14:32 出处:网络
when I was using boost::asio::async_write to send some large data, I found the data I receivedwas messed up, but total size was correct. it seemed like two groups of data ove开发者_运维百科rlapped. Wh

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..

  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, i.e. 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...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号