Talking with TCP server in binary protocol.

239 views
Skip to first unread message

Serge in Darkness

unread,
Dec 29, 2009, 11:44:25 AM12/29/09
to nodejs
To put it short: is it possible now to communicate with TCP servers
using some sort of binary protocol? I'm using php.js functions pack
and unpack, but it seems that I missing something here.

I'm connecting to Sphinx searchd, code is <a href="http://pastebin.com/
f262be9bc">here</a>.

I know code is clumsy, it's just a prototype. Basic layout of protocol
should be obvious from code, I think.

Some of my guesses is:

1) Is multiple connection.send() equals one send() with concatenated
data?
2) If not, how can I concatenate binary-packed strings? Javascript
seems to turn them into something unusable after using "+" with string.

Serge in Darkness

unread,
Dec 29, 2009, 12:13:11 PM12/29/09
to nodejs
It seems that switching connection encoding to binary and enforcing it
in each `send()` does not change anything. I will set up searchd to
write more verbose logs and will look what may be wrong.

christkv

unread,
Dec 29, 2009, 5:51:54 PM12/29/09
to nodejs
Hey Serge

I have been using

http://jsfromhell.com/classes/binary-parser

to create binary strings for a binary protocol.

Hope it helps

Christian

András Bártházi

unread,
Dec 30, 2009, 4:47:33 AM12/30/09
to nod...@googlegroups.com
Hi,

> To put it short: is it possible now to communicate with TCP servers
> using some sort of binary protocol? I'm using php.js functions pack
> and unpack, but it seems that I missing something here.
>
> I'm connecting to Sphinx searchd, code is <a href="http://pastebin.com/
> f262be9bc">here</a>.

You should check the JS native PostgreSQL client as an example:
http://github.com/creationix/postgres-js

Bye,
Andras

Reply all
Reply to author
Forward
0 new messages