Hi, Is there a way to read from a synchronous TCP socket without blocking the calling thread? Like using a time out, or checking how many bytes are present on the socket before reading? Thanks, Jean
You can use tcp::socket::available()
http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/reference/basic_str...
or:
boost::asio::socket_base::bytes_readable command(true);
socket.io_control(command);
std::size_t bytes_readable = command.get();
2008/7/10, Jean-Sebastien Stoezel
Hi,
Is there a way to read from a synchronous TCP socket without blocking the calling thread? Like using a time out, or checking how many bytes are present on the socket before reading?
Thanks, Jean
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Great thanks! On 10-Jul-08, at 3:37 AM, Igor R wrote:
You can use tcp::socket::available() http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/reference/basic_str...
or: boost::asio::socket_base::bytes_readable command(true); socket.io_control(command); std::size_t bytes_readable = command.get();
2008/7/10, Jean-Sebastien Stoezel
: Hi,
Is there a way to read from a synchronous TCP socket without blocking the calling thread? Like using a time out, or checking how many bytes are present on the socket before reading?
Thanks, Jean
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Igor R
-
Jean-Sebastien Stoezel