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:
@@ -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();
|
||||
|
||||
|
||||
@@ -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()));
|
||||
|
||||
@@ -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()));
|
||||
|
||||
Reference in New Issue
Block a user