zlib APIs usage problem in C++ program

Discussion in 'C++' started by nagrik, Jun 29, 2006.

  1. nagrik

    nagrik Guest

    Hello Group,

    I am writing a http client and reading a web page from the server. The
    page can be compressed in any
    of the format namely; gzip or deflate or compress. My client reads the
    page in chunks from the socket
    and then passes on the decompressed data to the user.

    I am makeing use of zlib APIs to decompress the data read from the
    server.

    The problem I am having is that these APIs can only compress the data
    if it is in a file,, whereas my
    requirement is to decompress the data from the buffer.

    Can someone tell me with a better solution or must I first put the read
    data from socket into the file and
    then decompress data by using the zlib APIs.

    Thx.

    nagrik
     
    nagrik, Jun 29, 2006
    #1
    1. Advertising

  2. nagrik schrieb:
    > Hello Group,
    >
    > I am writing a http client and reading a web page from the server. The
    > page can be compressed in any
    > of the format namely; gzip or deflate or compress. My client reads the
    > page in chunks from the socket
    > and then passes on the decompressed data to the user.
    >
    > I am makeing use of zlib APIs to decompress the data read from the
    > server.


    Third party libraries are offtopic in this group.

    > The problem I am having is that these APIs can only compress the data
    > if it is in a file,, whereas my
    > requirement is to decompress the data from the buffer.


    Not true. The zlib can work on buffers. Look at these functions:

    deflateInit, deflate, inflateInit, inflate

    If you have questions about these, you have to ask in another place.

    Thomas
     
    Thomas J. Gritzan, Jun 30, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sankar
    Replies:
    12
    Views:
    459
    William Ahern
    Dec 6, 2006
  2. Sankar
    Replies:
    8
    Views:
    274
    CBFalconer
    Dec 5, 2006
  3. Matthew Brett
    Replies:
    4
    Views:
    1,169
    Matthew Brett
    May 9, 2010
  4. Daniel Berger
    Replies:
    5
    Views:
    265
    Roger Pack
    Jun 21, 2009
  5. Nicholas Wieland

    Most simple usage of zlib or pr-zlib

    Nicholas Wieland, Mar 9, 2011, in forum: Ruby
    Replies:
    4
    Views:
    342
    Jeremy Bopp
    Mar 10, 2011
Loading...

Share This Page