Reputation: 16603
we have a C++ MFC application and C# Web Service. They are communicating over HTTP, but as they are exchanging text data, compression will help a lot. But for some reasons, we can't use an external library.
We basically need to compress a byte array on one side and decompress it on the other side.
What should we use to compress our data? The best scenario would be if there is something in MFC/win32 api. Or is there some simplistic code with at most LGPL license that we could integrate into our project?
Upvotes: 2
Views: 1126
Reputation: 299730
As has already been said, the zlib
is probably what you are looking for.
There are several algorithms within:
deflate
and inflate
pairzlib
itselflzo
The simpler is probably lzo (I advise to pass the uncompressed size on the side), but zlib isn't very complicated either and the compression rate can be parameterized (speed / size trade off) which can be a plus depending on your constraints.
For XML data (since you were speaking of web services), LZO gave me a ~4x compression factor.
Upvotes: 3
Reputation: 55271
Can't you just switch on HTTP compression? http://en.wikipedia.org/wiki/HTTP_compression
Upvotes: 3