Routelearn.net
Course menu

TCP & UDP

Learn the two transport layer protocols behind every connection: how TCP makes sure every byte arrives, why UDP skips that for speed, and how port numbers deliver traffic to the right application.

Beginner · 11 lessons + test · Before this: OSI & TCP/IP Models

The transport layer is the layer of the TCP/IP model that carries data between applications on two hosts, using port numbers to identify each application. Its two main protocols are TCP, which is connection-oriented and reliable, and UDP, which is connectionless and adds very little overhead.

In simple terms: IP gets data to the right computer; the transport layer gets it to the right app on that computer. TCP checks that everything arrives, while UDP simply sends the data and moves on.

IP moves packets between devices. But a device runs many programs at the same time: a browser, a mail app, a video call. The transport layer (Layer 4) makes sure each piece of data reaches the right program. Its two main protocols, TCP and UDP, make very different choices about reliability and speed. This course explains both.

Your laptop192.168.1.20Home routerInternetWeb serverTCP 443DNS serverUDP 53
  1. 1. UDP: one quick question. The laptop asks the DNS server for the IP address of a name. There is no setup: just one message and one answer.
  2. 2. TCP: a reliable conversation. The browser opens a TCP connection to the web server. Every byte is numbered and confirmed.

What you'll learn

What Layer 4 adds

How port numbers deliver data to the right application, and the ports every CCNA student should know.

How TCP stays reliable

The header, the three-way handshake, sequence numbers, acknowledgements and resending lost data.

Flow control and closing

Windowing, slowing down when the network is congested, and ending a connection with FIN or RST.

When UDP is better

The small UDP header, why voice, video and DNS use UDP, and how to choose between TCP and UDP.

Skills you'll gain

  • Port numbers
  • Sockets
  • TCP header
  • 3-way handshake
  • Sequence numbers
  • Windowing
  • FIN & RST
  • UDP
  • netstat & ss

Who is this for?

This course is for CCNA students and anyone starting out in networking. If you know what an IP address is and roughly how the OSI layers fit together, you're ready.

Start the first lesson →

FAQ

Why does TCP need a handshake before sending any data?
The handshake confirms that both sides are reachable and ready. It also lets them agree on starting sequence numbers before any data is sent. TCP later uses those numbers to detect lost or out-of-order segments.
Can a single application use both TCP and UDP?
Yes. DNS is the classic example. Normal lookups use UDP because it is fast. DNS uses TCP when an answer is too large for one UDP message, and for zone transfers between DNS servers.
What closes a TCP connection?
Usually each side sends a FIN and the other side acknowledges it with an ACK, often four messages in total. A TCP connection is really two one-way streams, so each side closes its own direction. A reset (RST) can also end a connection immediately, without this exchange.