Please help with Hex Length and Binary Word

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul

    Please help with Hex Length and Binary Word

    Hi,

    (First apologies if this is not the most relevant place to post this
    but I wasn't sure of where was and I am writing my app in VB.)

    I'm attempting to parse a binary file for which I have the format. The
    format states that the general packet format is as follows

    Message header
    Hex Length of whole binary packet
    Binary Word of above Hex Length
    etc.

    I just wanted to make sure of a couple of terms before I start - most
    notably 'Hex Length' and 'Binary Word'.
    I guess binary word is just a binary representation of the hex length
    e.g. if the hex length was 8 then the binary word of hex length would
    be '1000'. However, what is meant by hex length and how is it
    determined? If you could provide an example I'd be grateful.

    Thanks

    Paul
  • Raoul Watson

    #2
    Re: Please help with Hex Length and Binary Word


    "Paul" <paulsmith5@hot mail.com> wrote in message
    news:ca236fb1.0 404020111.a96cb 33@posting.goog le.com...
    [color=blue]
    > I guess binary word is just a binary representation of the hex length
    > e.g. if the hex length was 8 then the binary word of hex length would
    > be '1000'. However, what is meant by hex length and how is it
    > determined? If you could provide an example I'd be grateful.
    >[/color]
    Hi Paul.. sounds like you have to ask whoever gave you that homework as to
    what he/she meant. We at the board have no idea on how to guess that
    meaning. It didn't make sense to me.

    The term "word" can be of different length depending on the language. In VB
    you have integer, single, double, long, variant, etc. for variable types.

    For obvious reason, you have to know exactly how many bytes this info is
    encoded in order to "read" the header properly.


    Comment

    • Korejwa

      #3
      Re: Please help with Hex Length and Binary Word


      On 2 Apr 2004 01:11:08 -0800, Paul <paulsmith5@hot mail.com> wrote:
      [color=blue]
      > I'm attempting to parse a binary file for which I have the format. The
      > format states that the general packet format is as follows
      >
      > Message header
      > Hex Length of whole binary packet
      > Binary Word of above Hex Length
      > etc.[/color]

      None of these terms have standard definitions. Look elsewhere in the
      document to see how these terms are interpreted for this particular file
      format. Post the document if you still can't figure it out.

      Comment

      • Evan Tomlinson

        #4
        Re: Please help with Hex Length and Binary Word

        I have to agree with previous contributors, but....

        There are always ways of applying guesses by using common definitions. I
        will analyse like this:

        1. Hex means data is presented in hexadecimal format
        2. Binary os obvious
        3. Word is usually a 16 bit value. (compare: bit, byte, word, longword etc)
        4. ength, since this is a header of course the length of the coming data
        block
        5. I assume the binary data length, i.e. number of binary words correspond
        to the length value

        No good answers but some guesses, but still one important problem: What is
        the length of the hex value? If not specified this can be one byte, two
        bytes, four bytes (these are the most common) or any length. I would guess
        for the moment that it is one byte, i.e. two characters.

        So an examle of how my interpretation would look like with some data:

        0A
        100110101001011 010110101111001 110110101110001 101110100110101 100010111100011 1
        011001110011111 001111101001100 110101100110101 101011010101101 011010011100101 1
        01101010


        Ok, so what does this the tell me? Well, with these conclusions it seems
        that your "binary" file is stored as a textfile, which is very uncommon and
        stupid since it only adds quite a lot of length to the file. So in the end
        here I am probably wrong anyway.

        Final answer will then be that your description is not only very sloppy but
        extremely bad. A lot of information is missing and leasve open areas for
        guessing.



        E.T. - wants a homing phone


        "Paul" <paulsmith5@hot mail.com> wrote in message
        news:ca236fb1.0 404020111.a96cb 33@posting.goog le.com...
        Hi,

        (First apologies if this is not the most relevant place to post this
        but I wasn't sure of where was and I am writing my app in VB.)

        I'm attempting to parse a binary file for which I have the format. The
        format states that the general packet format is as follows

        Message header
        Hex Length of whole binary packet
        Binary Word of above Hex Length
        etc.

        I just wanted to make sure of a couple of terms before I start - most
        notably 'Hex Length' and 'Binary Word'.
        I guess binary word is just a binary representation of the hex length
        e.g. if the hex length was 8 then the binary word of hex length would
        be '1000'. However, what is meant by hex length and how is it
        determined? If you could provide an example I'd be grateful.

        Thanks

        Paul


        Comment

        • Paul

          #5
          Re: Please help with Hex Length and Binary Word

          Hi,

          Thanks to all that responded. Apologies if there was not a lot to go
          on. I figured it out after analyzing the binary file in a hex viewer.
          Take for example the following extract from the binary file

          40 30 30 38 31 81 00

          The first byte (40 or '@') is the packet header
          Hex length = 30 + 30 + 38 + 31 = 129
          Binary word of hex length is as somebody suggested the next two bytes,
          i.e. 81 00, or 129 in decimal.

          Thanks again,

          Paul

          Comment

          Working...