   how to work out the latency?
  how to work out the latency bewteen client and server???   
  Latency usually means the round-trip time (i.e., the time to go there and back again) between server and client. If you are using a custom network engine, the best approach is probably to simply designate a message type as "ping", and when the client receives it it replies with "pong". The server takes note of the time  when the ping message was sent, and when the pong message was received. By subtracting the time when the ping was sent from the time the pong was received, you get the round-trip time.If you are using a 3rd party network engine such as RakNet, it probably already provides facilities for accurate latency measurement. In that case, you should refer to the documentation of the network engine you are using.   