Packet compression for Delphi 5 and Midas 3

ZipMidas is a delphi package for compressing packets passed between TClientDataSet in the client and TDatasetProvider in the server. It uses zlib compression. ZipMidas requires DelphiZLib library from base 2 technologies. The source of DelphiZLib is included in ZipMidas archive for simplicity.

To use ZipMidas, first install the package. It will place 2 components into ZipMidas palette of Delphi : TZipClientDataset and TZipDatasetProvider. Use TZipClientDataset where you would normally use TClientDataset and TZipDatasetProvider where you would use TDatasetProvider. Both of these classes publish a single new property : MinimumZipSize. This property specifies the minimum size of the packet that needs to be compressed. A negative value tells the components not to perform any compression. The properties default to -1. Compressing every packet (the MinimumZipSize value of 0) does not make much sense but neither does it create much overhead.

If you need to find out how much compression and overhead ZipMidas is providing you with, you can use the built-in logging facility. A procedure of type tlogproc = procedure(s : string) of object should be assigned to variable logproc of zipmidas unit. The procedure will be called at the start and end of zipping and unzipping process. The string passed to it will report the initial and resulting buffer sizes as well as the time it took to process them.

Compressed packets are not compatible with default Midas packets, therefore it is very important to have TZip... components in both client and server or not use compression at all. While quite an obvious thing to watch out for, this error has come up enough times to warrant mentioning it here :)

ZipMidas has been deployed in 2 very active applications for at least 6 months now and has caused no problems whatsoever. However, I assume no responsibility for it. Use it at your own risk.

Get ZipMidas source here.