There are two types of reading-from-stream f开发者_开发技巧unctions for boost::asio::ip::tcp::socket
. I am assuming they their semantics vary. Could someone please outline them, the documentation I have looked through does not clarrify this.
As it says in the documentation:
The
receive()
operation may not receive all of the requested number of bytes. Consider using theread()
function if you need to ensure that the requested amount of data is read before the blocking operation completes.
If you actually meant read_some()
, then there is no difference. receive()
is the socket-specific function, whereas read_some()
is the generic function available for all asio streams. (much like std::string
's length()
and size()
)
精彩评论