I am testing on libuv for server.
The problem is that the data is to arrive partially and I need to wait for more data. (this situation hasn't occurred yet but I think it is around the corner, in my experience)
But this libuv is dependent on event base, and next after_read() function doesn't guarantee the next packet would be the leftover.
I wonder how you work around. Thank you.
Added for more information. My concerned situation of splitted packet.
Assume Client A, Client B, Server S.
After step 3, I expect the rest A's 50bytes to arrive , but unlike my expectation, B's 100 bytes arrive. my goal is to merge step 3 (50bytes) + step 5 (50bytes) for A's entire data.
In libuv you don't wait for data, you request that data is read by calling uv_read_start
and then the read callback will be called when there is data to read. If your application needs to read complete packets of data, you typically want to use a state machine to know what state you're in, and keep buffering data until you have a full packet.