2

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?

3 Answers 3

3

As has already been said, the zlib is probably what you are looking for.

There are several algorithms within:

  • The deflate and inflate pair
  • zlib itself
  • lzo

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.

Sign up to request clarification or add additional context in comments.

Comments

3

Can't you just switch on HTTP compression? http://en.wikipedia.org/wiki/HTTP_compression

Comments

1

zlib has a very liberal license.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.