what is port number, in computer network terms

592 views

what is port number, in computer network terms

In: 3

9 Answers

Anonymous 0 Comments

On a network, each device or computer has a unique address – in internet terms, an IP or Internet Protocol address – 192.145.204.74 for example. This is like a unique everywhere address… like a postal or zip code (for you Americans) in conjunction with a street address**.

However, at each address there might be multiple programs wanting to send or receive data. So think of a network port like a mailbox in an apartment building. The IP address gets the data to the right building and the port gets the data to the right program at that building.

For example, web/http/browser traffic is on port 80. So a web server program running at reddit’s computer center will listen for requests on that port. Sending data to a different port at that server address will be ignored, unless the computer and appropriate programs running on it are configured to “listen” on the different ports.

Another example would be if your video game server uses port 1234. Spotify is streaming music on port 4070. Thus, your operating system (or its firewall if you want to get picky) knows that anything coming to port 4070 it hands over to Spotify and anything destined for port 1234 it delivers to your video game.

If two or more programs were listening on the same port things would get confusing. If Spotify and your video game were both using the same port the video game would get a data packet for Spotify and go “wtf is this?” and your video game wouuldn’t behave properly. Or spotify would get a video game packet and try and decode it like Spotify music and it would be gobblygook.

There are, [by convention some ports that are reserved for specific types of services](https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers). For example web/http servers use 80 and 1080. Secure web traffic uses port 443. But beyond these commonly accepted or reserved ports you can just choose a “free” port for your own application. But unless you register it, if something else comes along using the same port there could be confusion.

** a street address isn’t good enough, there could be a 12 Maybury Ave. in two different cities. Likewise a postal/zip code can sometimes refer to multiple houses or buildings. But a zip code AND street address is most likely unique.

You are viewing 1 out of 9 answers, click here to view all answers.