In boost::asio::tcp, I can use boost::asio::read to read only part of a tcp socket.
boost::system::error_code error;
boost::asio::streambuf len_buffer;
size_t n = boost::asio::read(tcp_socket, len_buffer, boost::asio::transfer_exactly(1), error);
But the boost::asio::read function does not work with udp::socket.
Then how to read just some part of a udp socket, for example, read only 1 byte of the socket stream?
I have checked the receive() funciton, but it does not accept a length parameter. Does udp socket support partial reading at all?
Aucun commentaire:
Enregistrer un commentaire