TCP port and its importance

A TCP port is just a number… a 16-bit number that identifies a specific program on the server

0–65535 ports can be made available on server. The most common is port 80, which HTTP runs on. So normally on our own server, we go with 1024 and 65535 because 0-1023 are reserved for well-known services like SSH, HTTP, HTTPS, etc.

I find this analogy useful and easy to understand.

아무거나

Why is port important? Without port numbers, the server would have no way of knowing which application a client wanted to connect to. And since each application might have its own unique protocol, think of the trouble you’d have without these identifiers. What if your web browser, for example, landed at the POP3 mail server instead of the HTTP server? The mail server won’t know how to parse an HTTP request! And even if it did, the POP3 server doesn’t know anything about servicing the HTTP request.