Boost asio receive () vs read ()

There are two types of read-outflow functions for boost::asio::ip::tcp::socket . I assume that their semantics are changing. Can someone tell about them, the documentation that I looked at does not clarify this.

+4
source share
1 answer

As the documentation says:

The receive() operation may not receive all the requested number of bytes. Consider using the read() function if you need to make sure that the requested amount of data is read before the lock operation completes.

If you really meant read_some() , then there is no difference. receive() is a socket-specific function, while read_some() is a common function available for all asio streams. (something like std::string length() and size() )

+5
source

All Articles