NodeJS is great for sending binary data over a TCP socket. I do it all the time. Only use strings if you want one of the string encodings of your data. The default is "utf8" which disallows several bit patterns. Buffers act somewhat like arrays of integers and let you send exact bytes with full control.
On Wed, Aug 8, 2012 at 9:44 PM, trembl <scoobidoo_...@hotmail.com> wrote: > Tanks for the answer mr. Noordhuis, > > it is effectively as string that i send wich is at the base an array of hex > values eg: > > //===================================== > var mCmd = new Array(34); > mCmd[0] = 0x46; > mCmd[1] = 0x49; > ... > > for (i = 0; i < 34; i++) { > sFinsCmdRead= sFinsCmdRead+ String.fromCharCode(mCmd[i]); > } > //===================================== > > The question is how do i use buffer ? Is that as simples as : > > //===================================== > > buf = new Buffer(str.length); > > for (var i = 0; i < str.length ; i++) { > buf[i] = 0x00+i; > } > > > client.write(buf); > //===================================== > > > I will try tomorow if it is the case. > > What do you think about if using node.js is the best way to achieve my > purpose ? > > Tell me if i'm not clear. > > Thank again > > > > > > > -- > 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 nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en