Re: Compress::Zlib inflateInit help
- From: hymie_@xxxxxxxxxxxxxxxxxxxxxx (hymie!)
- Date: Wed, 30 Apr 2008 10:45:13 -0500
In our last episode, the evil Dr. Lacto had captured our hero,
Paul Marquess <paul.marquess@xxxxxxxxxxxxxx>, who said:
The key part I didn't know was you are dealing with a sequence of compressed
RFC 1951 data streams that are each prefixed with a bespoke header. So that
means you need to deal with reading both compressed & non-compressed data
from the socket.
Sorry. I didn't realize that the data and the acquisition of the data
were so badly intertwined.
my $header;
my $header_size = 8 + 4 + 4; # time + sequence + size
while (read($socket, $header, $header_size) == $header_size)
{
my ($time1, $time2, $sequence, $size) = unpack "NNNN", $header;
rawinflate $socket => \$data, InputLength => $size
or die "Cannot uncompress: $RawInflateError\n";
print "$data\n";
}
This is perfect!!!
Thank you so much for your help.
--hymie! http://lactose.homelinux.net/~hymie hymie@xxxxxxxxxxxxxxxxxxxxx
------------------------ Without caffeine for 547 days ------------------------
.
- References:
- Compress::Zlib inflateInit help
- From: hymie!
- Re: Compress::Zlib inflateInit help
- From: Paul Marquess
- Re: Compress::Zlib inflateInit help
- From: hymie!
- Re: Compress::Zlib inflateInit help
- From: Paul Marquess
- Compress::Zlib inflateInit help
- Prev by Date: Re: What's wrong with transparency by GD?
- Next by Date: Re: Read 20 lines when pressing n for next
- Previous by thread: Re: Compress::Zlib inflateInit help
- Next by thread: FAQ 3.1 How do I do (anything)?
- Index(es):