On Wed, 31 Jan 2024 at 21:46, Seth via Boost
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.
Another way that supports RAII (at least with a unix-like OS): boost::asio::ip::tcp::socket io_sock(io_ctx); io_sock.assign(boost::asio::ip::tcp::v4(), *::dup(*socket2*)*);
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost