Boost logo

Boost Users :

Subject: [Boost-users] [Boost::asio] Problem using the same io_service with many sockets
From: María Victoria Rocha (victoria_at_[hidden])
Date: 2016-09-30 14:16:35


Hi all,

I have defined an io_service that is used by two sockets, one of them
uses tcp, and the other udp.

When the callback of this async_read_some is called

socket.async_read_some(boost::asio::buffer(readBuffer),
boost::bind(&RequestHandler::onRead, shared_from_this(),
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));

A udp socket is created with the same io_service and an
async_receive_from is called. On the callback of this read operation I
try to write to the tcp socket but it captures an exception with
message: "unknown exception".

When this happens, the client that is listening to the tcp socket,
receives "End of file" error.

I resolved this problem with an io_service per socket but I would like
to use the same io_service.

Someone has any idea why this happens?

Thanks!

Victoria


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net