I want to know what is the logic behind server client communication through packets for a real time game. for example the server sends x packets then the client receives x packets and processes them..
Basically what is the process to keep the client and server in sync and able to receive and send packets.
more in depth example of what I want to know:
step 1 wait for a packet
step 2 read x packets
step 3 process x packets
step 4 send x packets
and so on...
I need to know the very basic outline of the communication.
Big questions are:
1) do I send and read packets all at one time? i.e for loop though the incoming packets array list and read them all or one every server loop or what...
2) what order should I do things i.e first receive then read then process then send etc..
3) what I asked above a step by step of what the server / client should do..