0
0
Computer-networksConceptBeginner · 3 min read

What Are Well Known Ports in Networking: Definition and Examples

Well known ports are predefined network ports numbered from 0 to 1023 assigned to common services and protocols. They help computers identify the type of network service, like HTTP on port 80 or FTP on port 21. These ports are standardized to ensure devices communicate correctly over the internet.
⚙️

How It Works

Think of well known ports as reserved phone extensions in a large office building. Each extension connects you to a specific department, like sales or support. Similarly, in networking, these ports are special numbers that tell your computer which service it wants to talk to on another device.

When your computer sends or receives data, it uses these port numbers to direct the information to the right program. For example, when you visit a website, your browser connects to port 80 or 443 on the server, which are the standard ports for web traffic. This system helps organize network communication so different services don’t get mixed up.

💻

Example

This example shows how to check if a common well known port (HTTP port 80) is open on a server using Python.

python
import socket

def check_port(host, port):
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
        sock.settimeout(2)
        result = sock.connect_ex((host, port))
        if result == 0:
            return f"Port {port} is open on {host}."
        else:
            return f"Port {port} is closed on {host}."

print(check_port('example.com', 80))
Output
Port 80 is open on example.com.
🎯

When to Use

Well known ports are used whenever devices communicate over the internet or local networks using standard services. For example, web servers listen on port 80 (HTTP) or 443 (HTTPS) to serve websites. Email servers use ports like 25 (SMTP) to send mail.

If you are setting up a server or configuring a firewall, knowing these ports helps you allow or block the right traffic. Developers also use these ports to test if services are running correctly.

Key Points

  • Well known ports range from 0 to 1023 and are assigned by the Internet Assigned Numbers Authority (IANA).
  • They correspond to common services like HTTP (80), HTTPS (443), FTP (21), and SMTP (25).
  • Using these ports ensures devices and applications communicate using agreed standards.
  • Only privileged programs or administrators can open these ports on most operating systems.

Key Takeaways

Well known ports are standard port numbers from 0 to 1023 assigned to common network services.
They help computers identify and connect to specific services like web servers or email servers.
Common examples include port 80 for HTTP and port 443 for HTTPS.
Knowing these ports is essential for configuring networks, firewalls, and servers.
Only authorized programs can use well known ports to maintain security.