Lesson 5 of 8 · 30 minutes

TCP, UDP, and ports

Read a transport conversation and distinguish reliable byte delivery from an application response.

What you will learn

  • Identify a TCP handshake and the two endpoints of a flow.
  • Compare TCP’s ordered byte stream with UDP datagrams.
  • Distinguish transport success from application success.

Ports identify transport endpoints

IP addresses locate hosts or interfaces; ports help direct traffic to application endpoints. A client typically chooses a temporary source port and contacts a server’s service port. Record the protocol, both IP addresses, and both ports to distinguish conversations. TCP port 53 and UDP port 53 are separate transport endpoints.

Common service ports are useful clues: HTTP often uses TCP 80 and HTTPS often uses TCP 443. Applications can use nonstandard ports, and HTTP/3 uses QUIC over UDP, commonly on 443. Confirm the observed protocol rather than assuming a port number proves the application.

TCP establishes and tracks a byte stream

A typical TCP connection starts with SYN, SYN/ACK, and ACK. Each side establishes sequence information. Sequence numbers track bytes, and acknowledgements indicate the next expected byte. Lost data can be retransmitted; receivers advertise a window to limit how much data they can accept.

A FIN indicates that a sender has finished sending, while a reset abruptly terminates or rejects a connection. A completed handshake establishes transport communication at that point in time. It says nothing by itself about whether a login succeeds or a web page is correct.

UDP keeps the transport simpler

UDP sends individual datagrams without TCP’s connection handshake, retransmission system, or ordered byte stream. Applications decide whether and how to retry, sequence, or tolerate missing messages. This can suit short queries and time-sensitive media, but UDP is not a promise of speed or successful delivery.

When analysing UDP, pair application requests with replies using addresses, ports, and protocol fields such as a DNS transaction ID. Absence of a TCP handshake is normal for UDP. Some protocols can use both transports, so inspect what was actually used.

Keep these points in mind

  • Identify a TCP handshake and the two endpoints of a flow.
  • Compare TCP’s ordered byte stream with UDP datagrams.
  • Distinguish transport success from application success.

Pause and practise

A trace shows a complete TCP handshake followed by an application error. A second trace shows a UDP DNS query and response without any handshake. Explain why neither trace proves a transport fault.

Show a worked response

The first trace established TCP; the later error needs application-level interpretation. The UDP exchange does not need a transport handshake. Compare its query and response fields to assess the application result rather than looking for TCP flags.

Check your understanding

Choose the best response to each scenario, then check your reasoning. These are course practice questions.

1. What does a completed TCP handshake alone establish?

0 of 1 answered

Next lesson →
← Previous lesson