If ASIO had better documentation I could probably have found for myself an answer, but instead...
Is there a way to determine bytes available to read using the asio::ip::tcp::iostream ?
I really like the tcp iostream because it's super-easy to use, but I haven't found it exactly feature-packed. Does it have a tcp socket in there somewhere?

void foo( boost::asio::ip::tcp::iostream& stm )
{
    std::size_t bytes_available = stm.rdbuf()->available() ;
    // ...

    // the native socket descriptor can be retrieved for platform specific 
    // socket functionality not available through asio. for example:
    auto fd = stm.rdbuf()->native_handle() ; // version 1.48. 
    // IIRC, used to be stm.rdbuf()->native() earlier
    ::ifreq interface_request ;
    ::ioctl( fd, SIOCGIFNETMASK, &interface_request ) ;
    // ...
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.