eli5: why so many ports?

135 views

“TCP also introduces a concept of a port: each connection has two ports, one for both sides. A port is an integer between 0 and 65535. A server typically waits for a new connection at a well-known port. Default ports for widely-used protocols are well-established and are typically small numbers, for example, HTTP uses port 80. A client also needs its own port. These ports are typically large numbers selected automatically by an operating system, based on what ports are available.”

Why is there a need for so many ports if there is just a client and a server? If there were multiple clients I assume the port number would need to be significantly big, but 65535 is relatively small.

In: 7

6 Answers

Anonymous 0 Comments

Why so many? Because they thought 16 bits was a good number of bits. The ports don’t cost anything because they’re not real – only the number that says which port it is, is real. They decided 16 bits was a good size for that number.

Every connection can be identified by the port number and IP address at *both* ends, so really there’s 96 bits in total, which is enough. The only reason a computer is likely to run out of ports is if it’s running tens of thousands of server programs because each server program needs a unique port on that computer.

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