IntermediateTopic 68 of 104Software & Computing

TCP and UDP

Reliable ordered delivery versus fast connectionless datagrams.

In depth

TCP provides reliable, ordered, connection-oriented delivery with handshakes, acknowledgements, retransmission, flow and congestion control. UDP is connectionless, low-overhead, unreliable: suited to streaming, gaming, DNS, VoIP. QUIC builds reliable transport over UDP.

Key points

  • Three-way handshake
  • Sliding window
  • Ports
Example

A file transfer uses TCP; a live video call uses UDP.

Why it matters

TCP and UDP offer different trade-offs between reliability and speed, so the choice affects how applications behave under loss.

Where this is used

  • Using TCP for a file transfer where every byte must arrive.
  • Using UDP for live video or game updates where delay matters more than loss.
  • Designing a sensor protocol that tolerates occasional lost readings.

Frequently asked questions

What is TCP and UDP?

Reliable ordered delivery versus fast connectionless datagrams.

Why is it important to understand TCP and UDP?

TCP and UDP offer different trade-offs between reliability and speed, so the choice affects how applications behave under loss.

When should I choose UDP?

When low latency matters more than guaranteed delivery, such as streaming, voice and some sensor telemetry.

How does TCP ensure reliability?

It uses sequence numbers, acknowledgements, retransmission and flow control, so data arrives in order and without gaps.

How is TCP and UDP used in practice?

Typical applications include using TCP for a file transfer where every byte must arrive, using UDP for live video or game updates where delay matters more than loss and designing a sensor protocol that tolerates occasional lost readings.

What should I learn before TCP and UDP?

Study "IP addressing and routing" first (topic 67 of 104 in Software & Computing). It covers the groundwork this topic builds on.

What are the key points of TCP and UDP?

Three-way handshake. Sliding window. Ports.

Can you give an example of TCP and UDP?

A file transfer uses TCP; a live video call uses UDP.

What comes after TCP and UDP?

The next topic is "DNS", which builds directly on this one.

How difficult is TCP and UDP?

It is classed as Intermediate in Software & Computing (topic 68 of 104). It is an intermediate topic. Work through the beginner topics in Software & Computing first.

Learning path

Want to practise? Open the interactive course for quick checks, quizzes, simulations and progress tracking.