BlueLines has asked for the wisdom of the Perl Monks concerning the following question:
i've got something like this set up on the client side:typedef struct Net_LogMsgHdr { int32 magic; Net_LogMsgType type; int32 nextLogChar; int32 logBufferSize; int32 length; int32 override; uint64 bootTS; uint64 pad; } Net_LogMsgHdr;
which in theory should work, except my perl doesn't grok 64 bit integers. i know i can compile a version that does, but that's not a solution, since this has to be portable amongst our development machines here. i thought about bitshifting, but the camel book has the following warning:my $sock = IO::Socket::INET->new( LocalAddr => '127.0.0.1:6300', LocalPort => 6300, Proto => 'udp', ); my $incoming; while ($sock->recv($incoming, 65536)) { my ($magic, $type, $nextLogChar, $logBufferSize, $length, $override +, $bootTS, $pad) = unpack "llllllQQ" , $incoming;
My machine (of course) uses 32 bit integers. So there's no way that i know of to go from a 128bit chunk of network data to two 64bit uints (excluding unpack). any ideas? cpan modules? *shudder* regexes?"Results on large (or negative) numbers may vary depending on the numb +er of bits your machine uses to represent integers".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pack() and non-64bit systems (old node)
by tye (Sage) on Mar 19, 2003 at 08:43 UTC | |
|
Re: pack() and non-64bit systems
by pg (Canon) on Mar 19, 2003 at 04:46 UTC |