CloudAcademia
EN

Networking · Module 08 · Transport Layer: TCP, UDP and Ports

Transport Layer: TCP, UDP and Ports

Overview2h 30min totalBeginnerMarkdown

Showing raw Markdown: the renderer could not load.

IP gets a packet to the right machine; the transport layer gets the data to the right program on that machine. This module explains how **ports** identify processes, when to use the **Transmission Control Protocol (TCP)** or the **User Datagram Protocol (UDP)**, how TCP sets up, controls and closes a connection, and how to read socket states when an application "can't connect".

## Learning objectives
By the end of this module you will be able to:
1. Explain the transport layer's job and how ports identify processes (well-known, registered and ephemeral ports).
2. Compare TCP and UDP (connections, reliability, ordering, overhead) and choose one for a given application.
3. Describe the TCP three-way handshake, connection teardown, sequence and acknowledgement numbers, retransmission and flow control.
4. Identify listening sockets and connection states (LISTEN, ESTABLISHED, TIME_WAIT) with `ss` or `netstat`.
5. Troubleshoot "connection refused" versus "connection timed out".

## Prerequisites
- [04 — The OSI Model](../04-osi-model/README.md) and [05 — IP Addressing](../05-ip-addressing/README.md).
- For the lab: Python 3 (standard library only), `nc` (netcat) and `ss` (Linux) or `netstat` (macOS, Windows). Capturing traffic with `tcpdump` is optional and needs administrator rights.

## Contents
| Type | Duration |
|---|---|
| [Theory](lesson.md) | 50 min |
| [Hands-on lab: TCP and UDP sockets on your own machine](lab.md) | 60 min |
| [Assessment (10 questions)](quiz.md) | 15 min |

## Further reading
- [RFC 9293](https://www.rfc-editor.org/rfc/rfc9293) — Transmission Control Protocol (TCP)
- [RFC 768](https://www.rfc-editor.org/rfc/rfc768) — User Datagram Protocol
- [RFC 6335](https://www.rfc-editor.org/rfc/rfc6335) — Procedures for the Management of the Service Name and Transport Protocol Port Number Registry
- [IANA Service Name and Transport Protocol Port Number Registry](https://www.iana.org/assignments/service-names-port-numbers/)