Thread: Zlib, GZip

  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    8

    Zlib, GZip

    I need to compress messages to a remote server and decompress messages which I receive from it. The remote server is running Windows and uses gzip from the class IO.Compression.GZipStream. The program on the remote server isnt my code, but I've looked at it and this is what it's doing.

    I am writing for Linux and will use zlib. I need to write compression and decompression which is compatible with Windows GZipStream. On my end, the information never needs to be read from or sent to a file. It will live its whole existence in variables.

    Here is the question. Can I use zlib's deflate() and inflate()? Will they be compatible with Windows gzip?

    Thanks.

    Brandon

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Their documentation at GZipStream Class (System.IO.Compression) states that it also uses zlib, so I'd be optimisitc - but the only way to be really sure is to try out a quick example.

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    8
    Thank you for your reply.

  4. #4
    Registered User
    Join Date
    Nov 2012
    Posts
    8
    I ultimately found an answer. It works if I use deflateInit2() instead of deflateInit() and add 16 to the parameter WindowBits. It's not real well documented. Going from buffer to buffer instead of from file to file was also kind of a headache, but is working now.

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    It's not real well documented.
    Thanks for coming back to report your results - now it IS documented!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Gzip encoded data from HTTP
    By Michael Colvin in forum Networking/Device Communication
    Replies: 7
    Last Post: 01-19-2012, 04:29 PM
  2. Gzip C++ function crashes my program.
    By azjherben in forum C++ Programming
    Replies: 2
    Last Post: 09-02-2009, 06:20 AM
  3. GZip
    By Dae in forum C++ Programming
    Replies: 1
    Last Post: 07-21-2009, 09:29 AM
  4. GZIP Data
    By cx323 in forum C# Programming
    Replies: 1
    Last Post: 06-22-2006, 07:31 AM
  5. How do you read gzip output from 'C' program?
    By brett in forum C Programming
    Replies: 5
    Last Post: 03-13-2006, 12:01 AM

Tags for this Thread