I am already not sure about the reading of the data from the network for binary data - I have used recv sofar only with text - does recv also work for binary data?
According to docs, if you didn't set anything special on socket with binmode(), it will receive bytes.
I don't know if it is important, but do all the message fit in 1024 bytes?
I'd also check compression/decompression starting with a simpler test: take a string, compress it, then decompress it and see if you received the original data back again. If it's fine, then try the same method on the socket.
You may also try with other modules, like IO::Uncompress::Gunzip.
<code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>