Re: inbox without an out!

From: Arnoud (galactus@stack.nl)
Date: Wed, 15 Jul 1998 22:01:45 +0200

In article <199807141711.KAA20536@ shell1.ncal.verio.com>,
Howard Schwartz <theo@ncal.verio.com> wrote:
> > The message format is very simple, for each message you first get four
> > bytes with the length of the message, then the message itself.
>
> You said the bytes that describe message length are ``in binary''. What
> code is used for the number of bytes - hex, octal?

The four bytes make up a 32-bits word, which is the length. If you read
the bytes "ABCD" from the file, then the length is

C * 2^24 + D * 2^16 + A * 2^8 + B bytes.

You have to look at the value of each byte, do this with a hex editor
or a file viewer that can switch to hex mode.

Note that this way of storing the length allows you to read it with
one operation on Intel-based system ("small endian order"). The SOUP
packet format uses "big endian order", there reading "ABCD" means the
length is

A * 2^24 + B * 2^16 + C * 2^8 + D

bytes.

-- 
\/  Arnoud "Galactus" Engelfriet - galactus@stack.nl              This space
    5th year Business & Computing Science student                 left blank
    URL: http://www.stack.nl/~galactus/  PGP: 0x416A1A35      intentionally.