2
0
mirror of https://github.com/boostorg/asio.git synced 2026-01-30 19:32:09 +00:00

Suppress recv truncation errors on Windows, to match POSIX behaviour.

This commit is contained in:
Christopher Kohlhoff
2017-12-02 18:25:44 +11:00
parent 286a6eb500
commit a57cb2a7a6
6 changed files with 21 additions and 9 deletions

View File

@@ -36,11 +36,7 @@ int main()
boost::array<char, 1> recv_buf;
udp::endpoint remote_endpoint;
boost::system::error_code error;
socket.receive_from(boost::asio::buffer(recv_buf),
remote_endpoint, 0, error);
if (error && error != boost::asio::error::message_size)
throw boost::system::system_error(error);
socket.receive_from(boost::asio::buffer(recv_buf), remote_endpoint);
std::string message = make_daytime_string();

View File

@@ -47,7 +47,7 @@ private:
void handle_receive(const boost::system::error_code& error,
std::size_t /*bytes_transferred*/)
{
if (!error || error == boost::asio::error::message_size)
if (!error)
{
boost::shared_ptr<std::string> message(
new std::string(make_daytime_string()));

View File

@@ -119,7 +119,7 @@ private:
void handle_receive(const boost::system::error_code& error)
{
if (!error || error == boost::asio::error::message_size)
if (!error)
{
boost::shared_ptr<std::string> message(
new std::string(make_daytime_string()));