比如說服務器向客戶端一次發送5.5K的數據,那么客戶端使用async_read_some異步讀取數據,一次讀取1K,分6次讀完,如何實現?
1 回答

吃雞游戲
TA貢獻1829條經驗 獲得超7個贊
回調函數的格式:
void handler( const boost::system::error_code& error, // Result of operation.
std::size_t bytes_transferred // Number of bytes copied into the
// buffers. If an error occurred,
// this will be the number of
// bytes successfully transferred
// prior to the error.);
std::size_t bytes_transferred 就是接收數據的長度。
添加回答
舉報
0/150
提交
取消