You need to do Flush(true) on the receiving side also. Read the documentation for Flush() in cryptlib.h for more information.
On the sending side, just use Put() instead of PutMessageEnd() unless you want to reinitialize the zlib compressor every time. ----- Original Message ----- From: <[EMAIL PROTECTED]> To: "Crypto++ Users" <[EMAIL PROTECTED]> Sent: Monday, March 26, 2007 11:10 AM Subject: ZlibCompressor/ZlibDecompressor usage > > Hi all, > > I'm having problems getting ZlibCompressor/ZlibDecompressor to work > and was wondering if anyone had any information that could help me. > > I am using ZlibCompressor and ZlibDecompressor in an existing network > framework, so I am not connecting it to any other > BufferedTransformations. I do a Put() and a Flush() on the source > side to force the end of a zlib message. I then do a Get() on the > receiving side, but there are usually no bytes available. The source > side's Flush() does not seem to be causing zlib end messages. Or > maybe I am just using the API wrong. > > Here are some code snippets: > > When compressing on the source side, I have tried Put() and > PutMessageEnd() followed by a hard flush: > > // put data into the compressor > m_ZlibCompressor.PutMessageEnd(reinterpret_cast<byte*>(data), size); > // flush it to mark the end of a zlib message > bool bFlushRet = m_ZlibCompressor.Flush(true); > // get size of compressed data > size_t outsize = > static_cast<size_t>(m_ZlibCompressor.MaxRetrievable()); > m_ZlibCompressor.Get(reinterpret_cast<byte*>(pOut), outsize); > > When decompressing on the other end of the network connection, I did > the following: > > size_t putSize = > m_ZlibDecompressor.Put(reinterpret_cast<byte*>(pBuffer->data()), > pBuffer->size()); > // tell filter we want to process whatever we have received > bool bFlushRet = m_ZlibDecompressor.Flush(false); > size_t bytesRetrievable = > static_cast<size_t>(m_ZlibDecompressor.MaxRetrievable()); > size_t getSize = m_ZlibDecompressor.Get(reinterpret_cast<byte*>(pIn, > bytesRetrievable); > > However bytesRetrievable is always zero. > > Thanks for any help! > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [EMAIL PROTECTED] More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~---
