0Pricing
Network+ Academy · Lesson

What Port Numbers Are For

Learn how ports direct traffic to the right service on a host.

What Port Numbers Are For is a free Network+ Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Network+ Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

One Host, Many Services

A single device often runs several network services at once — a web server, a mail server, and a file share. Port numbers let one IP address host many services by giving each a separate doorway.

The IP address gets the packet to the right host; the port number gets it to the right application on that host.

Sockets: IP Plus Port

Combine an IP address with a port number and you get a socket, the unique endpoint of a connection. For example, 192.168.1.10:443 is a socket for HTTPS on that host.

A connection is identified by the pair of sockets — source and destination — which is how a host keeps thousands of simultaneous conversations separate.

192.168.1.10:443  <- IP : port = socket

The Port Number Range

Port numbers are 16-bit values ranging from 0 to 65535. That gives 65,536 possible ports per protocol (TCP and UDP each have their own full range).

The huge range ensures a host never runs short of ports for the many connections it may handle at the same time.

Well-Known Ports

Ports 0 to 1023 are the well-known ports, reserved for common, standardized services. HTTP uses 80, HTTPS uses 443, and SSH uses 22.

These assignments are managed by IANA (Internet Assigned Numbers Authority) so that clients always know where to find a given service by default.

Registered Ports

Ports 1024 to 49151 are registered ports, assigned to specific applications by request, such as 3306 for MySQL or 3389 for RDP (Remote Desktop Protocol).

They are less rigidly controlled than well-known ports but still help avoid clashes between widely used applications.

Dynamic Ephemeral Ports

Ports 49152 to 65535 are dynamic or ephemeral ports. The operating system assigns one temporarily to the client side of a connection.

When your browser connects to a web server on port 443, your machine uses a random high ephemeral port as its source, which is released when the connection ends.

Source vs Destination Port

Every connection has two ports. The destination port identifies the service being reached (like 443 for HTTPS). The source port is the client’s ephemeral port for that conversation.

This pairing lets a host distinguish many connections to the same service, since each uses a different source port.

Why Default Ports Matter

Default ports let clients connect without specifying a number. Typing a web address quietly uses port 80 or 443. Running a service on a non-standard port means clients must be told the number explicitly.

Some admins change defaults for mild security through obscurity, but firewalls and rules must then be updated to match.

Ports in Firewall Rules

Firewalls allow or block traffic largely by port number. A rule permitting TCP 443 lets HTTPS through while blocking other services.

Closing unused ports reduces a host’s attack surface. Understanding ports is therefore central to both connectivity and security configuration.

Listening vs Open Ports

A service that is ready to accept connections is said to be listening on its port, and that port is then considered open. A closed port has no service waiting.

Attackers scan for open ports to find services to target, so technicians audit which ports are open and shut down any that are not needed.

Ports Tie It Together

Port numbers are the addressing layer above IP, directing data to the correct application. They make multiplexing many services on one host possible.

With the concept of ports clear, you are ready to learn the specific port numbers of the everyday protocols covered in the next lessons.

Quick Check

Recall the port ranges.

Recap

You learned what port numbers are for.

  • Ports let one IP host many services; IP+port = a socket.
  • Range is 0 to 65535 (16-bit), per transport protocol.
  • Well-known: 0-1023; registered: 1024-49151; dynamic: 49152-65535.
  • The destination port names the service; the source port is the client’s ephemeral port.
  • Firewalls allow or block traffic largely by port.

Frequently asked questions

Is the “What Port Numbers Are For” lesson free?

Yes — the full text of “What Port Numbers Are For” is free to read here on the web, and the Network+ Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Network+ Academy course, upgrade to CoddyKit PRO.

What will I learn in “What Port Numbers Are For”?

Learn how ports direct traffic to the right service on a host. You practise Network+ Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Network+ Academy?

No prior experience is required. Network+ Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “What Port Numbers Are For” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Network+ Academy lesson?

Yes. Every Network+ Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. TCP vs UDP at a Glance
  2. What Port Numbers Are For
  3. Web and File Transfer Protocols
  4. Remote Access and Mail Protocols
← Back to Network+ Academy