Original Post
This time it's all about packet reconstruction - as we all know, with TCP they come in order, but can be fragmented, so let's say we're sending two packets but we receive 3 on the server side due to fragmentation.
Every packet is encapsulated to some sort of structure, let's say our packets are:
MOVE_TO
int x,int y;
LOOK_AT
int objectid;
Of course each packet has it's length ( int ) and type ( int ) attached.
Now client sends both at once (it happens) to server,
but server receives half of MOVE_TO as one packet, and the rest of MOVE_TO + LOOK_AT in the second packet.
Of course the same situation can happen on client side, so that's why i am thinking globally here.
Now how do you guys approach this, some sort of "Inbox" mechanism, where after recv you push_back to client's recv_box
and analyze the list of them, or?
Any chance for pseudocode or already implemented working solution - so we all could have a look please?
thx!
Every packet is encapsulated to some sort of structure, let's say our packets are:
MOVE_TO
int x,int y;
LOOK_AT
int objectid;
Of course each packet has it's length ( int ) and type ( int ) attached.
Now client sends both at once (it happens) to server,
but server receives half of MOVE_TO as one packet, and the rest of MOVE_TO + LOOK_AT in the second packet.
Of course the same situation can happen on client side, so that's why i am thinking globally here.
Now how do you guys approach this, some sort of "Inbox" mechanism, where after recv you push_back to client's recv_box
and analyze the list of them, or?
Any chance for pseudocode or already implemented working solution - so we all could have a look please?
thx!