Re: compressed data from an asynchronous socket !!

[email protected]
Newsgroups gmane.network.gnutella.devel
Organization Home, Grenoble, France
Message-ID <[email protected]>
Quoting mark W <[email protected]> from ml.gnutella.dev-forum:
:Yeah, it's a continuous stream of data and each received block is related to
:earlier received blocks.

Good, so now you see the error in your earlier posting: you must not end
the stream after each received buffer / message but keep it open.

:One probable solution in mind is :
:Store the starting compressed chunk (beginning of stream) into a temp buffer.
:Whenever next compressed data comes, add this starting buffer to the received
:data and then pass it to inflater:

Why do you insist in storing data into a temp buffer: just give it to the
inflater, and be prepared to get output back out of it.  In other words,
you inflate on the fly and keep pushing the data to the inflater.

Of course, you must read some fixed amount of data out of the socket,
so if this is what you mean by "temp buffer", then yes.  But no extra buffering
of input is required at your level.

If you can get this all right, then you'll be done with the "easy" part.
The transmit side of a compressed connection (that is, deflation) is much
more complex than reception of compressed data.  Do you see why?

Raphael
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.