ZlibStream and packed based decompression.

Jan 17, 2011 at 10:28 AM

Hello I'm using ZlibStream to decompress data that comes by network from server.

I receive multiple packets.

Each packet is compressed by zLib stream (the server is native and I can't change anything there).

Each packet can be docompressed separatelly.

The porblem is that only first packet has header data required to decompress all data.

Of cource I can wait untill all packets arrive and only then decopress all of them.

But It would be better to decompress them on the fly (as soon as they arrive).

I tried to go through source code and looks like that ZlibStream caches somehow that input stream was once empty (when first packet was decompressed) and does not decopress anything.

Is it possible to fix that?

Or may be I'm doing something wrong?

Jan 17, 2011 at 3:08 PM

well, seems that I've fixed this myself.

I've added 

            nomoreinput = false;

at the begining of Read method of ZlibBaseStream.

Feb 9, 2011 at 7:37 AM

hi petka,


i want to do exactly what you did ..  i try to add this line of code in the beginning of Read method but it always throw "

Could not read block - no data!  (position 0x00000000)