Ports are communication endpoints that directs data to a specific service. Each port has its own designated number that act as a gate used to access resources and services.
- It is not a kind of physical hardware present in a computer
- Below 1024, each port is associated by default with a specific protocol.
- For example, HTTP listens on port 80 while HTTPS listens on port 443.
- Services, such as email/web/file/print services, can all run at the same time in one computer and share the same IP address.
- Ports allow each individual service to be kept apart despite having the same IP address.
- Think of an IP address as an apartment building and each port is the different apartments.
- Ports allow each individual service to be kept apart despite having the same IP address.
As part of the apartment analogy…
If you want to send a letter to someone that lives in a different apartment complex, they will obviously have a different address (IP address) and apartment number (port). The same idea applies here.
External links and sources
- Port - MDN Web Docs Glossary: Definitions of Web-related terms | MDN
- Port (computer networking) - Wikipedia
- What is a URL? - Learn web development | MDN
- A pretty good explanation of ports in an analogy: ELI5: What is a network port?