eli5: why so many ports?

144 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

You’re only thinking about this from the Client’s perspective.

Servers can have thousands or tens of thousands of simultaneous clients each of them requiring a different source port for the connection. So 65,535 often isn’t enough and you need to start using load balancing and other tricks to add more capacity.

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