I have a server that receives a compressed string (compressed with zlib) from a client, and I was using async_receive from the boost::asio library
async_receive
boost::asio
Use async_read_until and create your own match condition, or change your protocol to send a header including the number of bytes to expect in the compressed string.