Boost logo

Boost Users :

From: Igor R (boost.lists_at_[hidden])
Date: 2008-07-10 04:37:08


You can use tcp::socket::available()
http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/reference/basic_stream_socket/available/overload2.html

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 <js.stoezel_at_[hidden]>:
> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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