I'm building networked racing game right now. I'm using winsock with TCP/UDP socket and IOCP.
I'm having trouble with latency masking and I don't even know if my implementation is wrong.
So, I'm measuring latency between client and server with tcp packet. Server gives tcp packet with current time to client first and then client send back another tcp packet containing time value that received from server, and server would calculate the latency by (current_time - time_sent) / 2.
But as far as I know, tcp packet transfer time can be different every time based on network traffic and packet lose.
So, I'm wondering if I should use UDP packet for latency measure.
Can anyone give me advice for this one?