A port is one of the most important connectors for communication between computers or between a computer and the internet. The port can be used to assign sent data packages to a correct application so that the corresponding information can be interpreted correctly.
Each connection of an internet protocol - no matter if TCP or UDP - depends on ports as virtual connection elements for the exchange of information as well as for the data transfer. Thus, a port is part of the network address and is used to deliver the data packets correctly. Simplified, a port is the receiver information that is written onto the data packages on the Internet.
For example, when a user tries to open a website, the request is sent to the corresponding web server through port 80. Thus, the server knows which data to send back using the http protocol in order to display the desired content. This works similarly when sending and receiving e-mails, for which port 587 (SMTP with STARTTLS encryption) is reserved, among other things.
There are different types of port numbers, ranging from 1 to 65535. The first numbers are referred to as standard ports and are defined by the Internet Assigned Numbers Authority (IANA) for specific services and are used as standard on the web. The remaining available numbers can either be assigned directly to an application (user ports) or dynamically (dynamic ports).
Ports can assume different states. Open ports accept all addressed connections and forward them. Closed ports, on the other hand, reject the respective connection requests. Another important component in communication is the filtered port. It is used, for example, by a firewall. The incoming data package is checked to see whether it is forwarded to the desired application or not.