Bogdacutu
Bogdacutu

Reputation: 771

Node.js TCP input buffering

I'm not sure I got this right yet, but as I understand it, when I attach a handler to the data event, it gives me all the data it got until then. The problem is, how do I handle buffering that data, as Node.js might give me less that 4 bytes at a time (which is the minimum I need), especially when there will be multiple concurrent requests?

Upvotes: 3

Views: 2127

Answers (1)

alessioalex
alessioalex

Reputation: 63653

I think this problem has been tackled in this article: http://openmymind.net/2012/1/12/Reading-From-TCP-Streams/

Links to the 2 solutions described there:

Upvotes: 5

Related Questions