On 24/05/15 15:54, [email protected] wrote:
Hi Burak,
I'm not aware of any way how to enforce such behaviour on libuv but what
you can do is to process incoming data the way you want in the read_cb.
You can buffer or process the incoming data so that you call whatever
callback you need when you have data for it, i.e. after reading the 1st 4
bytes you call your callback and then once you have the tail in the buffer
call the other callback. Basically just add one more layer which will do
whatever logic you need.
Vilibald
PS: I assume that your `packet` is usually more than the one network
packet because otherwise you usually get the whole packet at once in one
callback, not that it is guaranteed but it behaves this way.
Hello,
I am very sorry for disturbing people at here, however based on my
research
i cant find a good way to parse the following packet with libuv.
I am porting a tcp server to libuv based one (C based program). However
the
data i want to read from the client is prefixed with static data and the
length.
0x11 0x22 0x0 0x0 (size of packet) PACKET DATA 0x22 0x11
I want my read callback to be executed after 4 bytes have been readed from
client.
Then, i know the size of rest of the packet till new one, i want my
callback executed when the size of packet + 2 (tail) bytes have been
readed
from the client. Then same steps again. (4 byte)
OR is there any recommended way to do this in libuv?
What Vilibald said. libuv doesn't "look" at the data, it just calls the
callback when there is data available, what to do with it is entirely up
to the application.
Regards,
--
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.