in reply to Re: Handling bits in Perl
in thread Handling bits in Perl
I read a bitstream from a Socket, running as a socket server. Data seems to arrive in streams of several kilobits, before the remote client closes the socket. (My study of http://www.perlmonks.com/index.pl?node_id=21054 suggests I should replace <> with sysread, in the hope of a more real-time read, but that is on the different topic of buffering and blocking.)
I am using Bit::Vector on these long bitstreams. But on re-reading the manual, I see some Bit::Vector operations are limited to 32 bits. (Block_Read, for example.) I'd appreciate some words of enlightenment on the safe way to handle very long bitstreams.
Should I laboriously process the bitstream 8-bits at a time, perhaps. Maybe using whatever is Bit::Vector's equivalent of rodion's previous posting on unpack( 'a a*', $rest )?
Many fields in the definiton of the bitstream are more than 8 bits long, some over 16. The spectre on endian-ness is haunting me.
Thank-you.
|
|---|