Binary to ASCII

Options
Naruto
Naruto Member Posts: 11 ✭✭

Hi @marc @Aaron

How do I convert the data received from queue(lvq) to ASCII or human readable format?

Comments

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 537 admin
    Options

    What is the binary format? If the payload is encoded with something like Google Protobufs or Avro, you'll need to deserialize it with the correct format.

    If you just want to dump the binary contents to the console, I would suggest using SdkPerf, it is probably the most common/useful Solace utility. You can find it here: https://solace.com/downloads/ (tick the box "Other" to find it.

    There are LOTS of parameters to use with it, but just to dump a message contents to the console, it will look something like:

    sdkperf_lang -cip=<HOST> -cu=<USER>@<VPN> -cp=<PASSWODRD> -sql=<QUEUE_NAME> -qb -md
    e.g. ./sdkperf_java.sh -cip=localhost -cu=aaron@default -cp=pw -sql=q1 -qb -md
    

  • Naruto
    Naruto Member Posts: 11 ✭✭
    edited April 1 #3
    Options

    @Aaron @marc

    I am dumping the message contents on the console itself & the binary format is like this —

    00 00 47 4c aa 21 da 99 21 61 13 84 c3 29 64 5f ..GL.!.. !a...)d_
    79 12 43 4b b7 00 00 53 54 6f 00 00 58 02 00 00 y.CK...S To..X...

    this is not exact binary it contains hex decimals values as well. How do I change it to ASCII ?

    e.g - -./Browser.c -cip=<HOST> -cu=<USER>@<VPN> -cp=<PASSWODRD> -sql=<QUEUE_NAME

  • Naruto
    Naruto Member Posts: 11 ✭✭
    Options

    @Aaron @marc

    After trying the command with C, the output still remains the same as binary & hex decimal.
    The cmd I used —
    /sdkperf_c -cip=<host> -cu=<username>@<vpn> -cp=<password> -sql=<queue> -qb -md

    The output I got —
    60 50 5b 5f 79 12 43 be 88 00 00 53 18 fc ff ff P[_y.C. ...S....


    77 01 00 00 47 9e fa d4 b7 e1 6d 61 13 34 60 50 w...G... ..ma.4
    P

    how do I change it to human readable format?

    Please help me with this

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 537 admin
    Options

    That is ASCII, on the right. Hex codes on left, ASCII equivalent on the right. Anything that's a valid/printable ASCII char will show up, otherwise SdkPerf substitutes a period . char. That's why you can see the characters P, y, C, S, w, etc… but there are periods for everything else as they are either 0x00, 0x01, or out of range (e.g. > 0x7f).

    There's nothing more to see here, you're going to need to know the payload format to know how to deserialize this binary payload correctly.

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 537 admin
    Options

    If you find out it's Google Protobufs, I have a utility that can probably help you.

  • Naruto
    Naruto Member Posts: 11 ✭✭
    edited April 2 #7
    Options

    @Aaron

    Thanks for the feedback. Few more queries—

    does sdkperf have deserialization mechanisms inbuilt?
    Can I get the data in json format in anyway?

    please share your thoughts on this with the utility.

  • Naruto
    Naruto Member Posts: 11 ✭✭
    Options

    Hi @Aaron

    Please help me with the answers

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 537 admin
    Options

    Hi again @Naruto. No, SdkPerf has no pluggable capabilities for providing a deserialization mechanism. You'd have to code something yourself if you know the proper encoding format.