i've zmq implementation in node. i subscribe for one topic among all 
channels and got message in slow buffer object.

if i directly print that message on console, i got something like this.

<SlowBuffer 49 12 00 00 5a 00 00 00 00 00 00 00 00 00 00 01>

so this is slowbuffer object containing raw data. and i'm trying to convert 
it in readable format. 

here is my code

console.log("Type of Message "+err.readInt8(0));
        console.log("action "+err.readInt8(1));
        var temp = "";
        var s = ""
        for (var i=0;i<8;i++) {
            temp += err.readInt8(i + 8)

        }
        console.log("dpid "+temp);

output

Type of Message 73
action 18
dpid 00000003

now i have to format dpid in 00:00:00:00:00:00:00:02 this format. it may 
contain character and digit, hexadecimal. so i have to convert dpid to hexa 
decimal and check whether it is two character then oky otherwise i have to 
add extra "0" at front. something like that. i'm very new to this concepts. 
i don't know how to do this ?

please help me.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/ff930c69-1a22-4d3a-aabb-3be9cc4a7bfa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to