I am trying to use socket::receive
in boost asio to receive data over network. I want it to blo开发者_JS百科ck until certain size of data is available. For that it seems that I will have to set message_flag
argument to the receive function, but I cannot find the information on what value can I pass so that the receive will be blocked until certain size of data is available. All I seen that its an integer.
Can someone tell me what are valid values that can be passed?
For that it seems that I will have to set message_flag argument to the receive function
This is incorrect. There are overloads to the async_read or read free function. They will read as many bytes as you request based on the buffer size:
Remarks
This overload is equivalent to calling:
boost::asio::read( s, buffers, boost::asio::transfer_all());
精彩评论