On Fri, Sep 7, 2012 at 10:05 AM, Neha <[email protected]> wrote:
> Is there an equivalent of java command writeShort() & writeByte() in net.js?
> Can I write bytes and short instead of simply writing a string to a socket?

var buf = new Buffer(6);
buf.writeInt16(42, 0);
buf.writeInt32(1337, 4);
sock.write(buf);

> Also, can I write a JSON object - an equivalent to the following in python:-
>
> json_message=json.dumps(message)
> s.send(json_message)

sock.write(JSON.stringify(message))?

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to