On 02/09/15 11:24, KN wrote:
I'm aware of netstrings, and in fact, my approach is similar. A frame
would be of the format [client_id][frame_data] . E.g.
[123][ABCDEF]
My question, though is, if I had no way to guarantee that the message
will not be split up into chunks arbitrarily, firing multiple read
callbacks, then my message could get broken up like this:
[123][ABC]
[DEF]
When I get [DEF] in my read callback, I would have no idea that this
data came from client 123.
I'd assume you keep the partial message around until you're done with it.
Or you could use UDP and send all the data in a single packet, assuming
it fits. Or SOCK_SEQPACKET, but libuv doesn't support that.
At any rate, we can't guarantee that the kernel won't break the message
into multiple chunks so you better solve it at the protocol layer.
Cheers,
--
Saúl Ibarra Corretgé
http://bettercallsaghul.com
--
You received this message because you are subscribed to the Google Groups
"libuv" 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].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.