Currently I am receiving data synchronously in the following manner
boost::array<char, 2000> buf;
while(true)
{
std::string dt;
size_t len = connect_sock->receive(boost::asio::buffer(buf, 3000));
std::copy(buf.begin(), buf.begin()+len, std::back_inserter(dt));
std::cout << dt;
}
My question is whether this method is efficient enough to receive data that exceed the buffer size . Is there any way that I could know exactly how much data is available so that I could adjust the buffer size accordingly ? (The reason for this is that my server sends a particular response to a request that needs to be processed only when an entire response has been stored in a string variable.