A port, in networking, is a number that defines what application an internet connection is attempting to connect to.
Port numbers are typically well defined. For example, by definition, a mail server will “listen” for incoming connections on port 25. When an attempt is made to connect to that server requesting a connection to port 25, that means that the machine requesting the connection wants to “talk to” the email server listening there, presumably in order to send mail.
There are hundreds of different pre-defined port numbers for all common services. Some common examples:
One way of looking at port numbers might be to think of them as apartment numbers in a large apartment building.
The apartment building’s street address might be analogous to the server’s IP address, which locates the apartment building (server). Once at the front door, the apartment number (port number) locates the specific resident (service) you wish to talk to. If that resident (service) doesn’t respond, it might be because their door is locked (access blocked, perhaps by a firewall) or they’re not home (the service isn’t running).
Not all port numbers exist on all servers, because not all servers provide all possible services; that would be analogous to an apartment number that doesn’t exist at a particular address.
Port, when used in reference to hardware, is a physical connection to a machine.
A desktop computer might come with several ports, including USB ports, networking ports, display ports, and more.