A port in Internet connection is used to separate different types of connections (called protocols) from the Internet. Doing so make it easier for different software to handle each type of connection.
In actual use a port is just an integer. One uses the following format to send/receive data through a port on a machine:
- IP_Address:PORT (eg: 188.8.131.52:80)
- DOMAIN:PORT (eg: wikipedia.com:80)
When we connect to a browser we don’t specify any port number. This is because we are using http/https connection, and the browsers know to route them to port 80/443.
Different ports can be connected with the same type of connection. For example web programmers often test their local websites on their browser through a different port other than standard http port 80, like 8000:
- A real marine port: different ports sometimes only allow specific type of ship. You can’t park a tanker at a yacht port. But some ports can be used to park same types of ship.
- Parking lot
- 80: default port for HTTP protocol connection.
- 443: default port for HTTPS protocol connection.
- 22: default port for SSH protocol connection.
- 25: default port for SMTP protocol connection.