TCP Port Numbers: A Comprehensive Guide 🎯

beginner
15 min

TCP Port Numbers: A Comprehensive Guide 🎯

Welcome to our tutorial on TCP Port Numbers! In this lesson, we'll dive into the world of computer networking, focusing on TCP (Transmission Control Protocol) and its essential port numbers. By the end of this tutorial, you'll have a solid understanding of TCP port numbers, their importance, and how they're used in real-world projects.

What are TCP Port Numbers? 📝

TCP port numbers are 16-bit values used to identify network services and applications. They allow communication between different devices and applications on a network. Think of them as the "addresses" for specific services on a computer, just like your home address guides delivery to the right door.

Understanding Port Numbers 💡

TCP port numbers are divided into three ranges:

  1. Well-known ports (0-1023): These are reserved for system services, such as HTTP (80), SMTP (25), and FTP (21).

  2. Registered ports (1024-49151): These are used for less common applications and services.

  3. Dynamic and private ports (49152-65535): These are used by operating systems to assign ephemeral (temporary) ports for applications as needed.

TCP Port Number Examples 💡

Let's look at two examples to better understand how TCP port numbers work:

Example 1: Web Browsing (HTTP)

When you visit a website, your browser establishes a connection with the server using the HTTP protocol, which listens on port 80 by default.

bash
Client (Browser) ──────────────────────────────────────────────────────────────