Boost logo

Boost :

From: Seth (bugs_at_[hidden])
Date: 2024-01-31 20:37:17


On Thu, Jan 18, 2024, at 7:18 PM, Dominique Devienne via Boost wrote:
> Hi,
>
> I'm trying to use ASIO to wait until a socket is ready to read, or timeout.
> This is a blocking wait. But the socket is not "owned" by ASIO, but is from
> the libpq PostgreSQL connection. So ASIO should NOT consume any of
> the input on the socket, just notify me when that socket is "read-ready".
>
> I've cobbled together the following test code:
>
> ```
...
> boost::asio::ip::tcp::socket io_sock(io_ctx);
> io_sock.assign(boost::asio::ip::tcp::v4(), socket2);

You `assign()`ed the fd, but never `release()` it, so the socket desctructor closed it.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk