I am receiving data from a server through a socket using boost asio, and the data is compressed using zlib. I need to inflate this data once I get it. Is there an easy way to do this using boost? Or any other way? The code is C++.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The Boost.Iostreams library includes a zlib decompressor filter (link). You can read a chunk of data from the socket into a buffer then decompress, or you can (hopefully, but I haven’t tried it myself) chain the filter onto the socket and read decompressed data straight out of the end of the filter.
Note, however, that you have to re-compile boost with zlib support. (link)