Thanks! I read the Flush() comments, but I am not clear if the following situation will be handled as I expect:
Will the Put(), Flush(true), and Get() on the destination side deal okay with a partial receive of data? An example: A 100 byte Put results in a 50 byte Get() on the source side, the 50 bytes is sent over a TCP socket to the destination, but only 30 bytes are read on the first socket receive on the destination. The destination Put()s the 30 bytes into the ZLibDecompressor, does a Flush(true), and tries a Get() of MaxRetrievable() bytes. Will MaxRetrievable() return 0 or a partial amount (< 100)? Afterward, will it deal with receiving and Put()ing the other 20 bytes, followed by a Get() of MaxRetrievable() bytes (resulting in either the full 100 bytes, or the remaining bytes if a partial Get occurred previously)? Also, do the Crypto++ Zlib classes support custom dictionaries? I did not see any mention of custom dictionaries in the API. The zlib documentation calls this a Preset dictionary, controlled by the FDICT (Preset dictionary) flag in the zlib stream. Thanks again! On Mar 26, 4:15 pm, "Wei Dai" <[EMAIL PROTECTED]> wrote: > 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. -~----------~----~----~----~------~----~------~--~---
