Comment

Comment by mjevans

The main difference between TCP and UDP, as this programmer discovered, relates to quality of realtime service.

Times to use UDP over TCP

  * When you need the lowest latency
  * When LATE data is worse than GAPS (loss of) in data.
  * When you want to implement your own form of error correction to handle late/missing/mangled data.
TCP is best when

  * You need all of the data to arrive, period.
  * You want to automatically make a rough best estimate use of the available connection for /rate/ of transfer.
For a videogame, having a general control channel to the co-ordination server in TCP is fine. Having interactive asset downloads (level setup) over TCP is fine. Interactive player movements /probably/ should be UDP. Very likely with a mix of forward error correction and major snapshot syncs for critical data (moving entity absolute location, etc).
parent mjevans 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton