C++ 如何获取异步读取boost asio c++;
正如我在Boost::asio中看到的,异步读取函数不返回传输的字节数,但正常读取函数会返回。当我使用async\u read\u some时,如何获得传输的字节数?(Params:buffer,handler)期望表单的“C++ 如何获取异步读取boost asio c++;,c++,sockets,asynchronous,boost-asio,C++,Sockets,Asynchronous,Boost Asio,正如我在Boost::asio中看到的,异步读取函数不返回传输的字节数,但正常读取函数会返回。当我使用async\u read\u some时,如何获得传输的字节数?(Params:buffer,handler)期望表单的“ReadHandler”回调 void handler( const boost::system::error_code& error, // Result of operation. std::size_t bytes_transferred
ReadHandler
”回调
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.
);
回调的第二个参数将是读取的字节数。预期窗体的“ReadHandler
”回调
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.
);
回调的第二个参数是读取的字节数。读取完成后,异步读取函数调用“处理程序”函数(或函数对象)。传输到该函数的字节数;函数的签名必须是:
void handler(
const boost::system::error_code& error, // Result of operation.
std::size_t bytes_transferred // Number of bytes read.
);
读取处理程序的要求已记录在案一旦读取完成,异步读取函数将调用“处理程序”函数(或函数对象)。传输到该函数的字节数;函数的签名必须是:
void handler(
const boost::system::error_code& error, // Result of operation.
std::size_t bytes_transferred // Number of bytes read.
);
已记录读取处理程序的要求您是否查看了文档?这是一个非常基本的信息,出现在任何与套接字相关的示例或函数参考中。您看过文档了吗?这是出现在任何套接字相关示例或函数参考中的非常基本的信息