Interview Prep/Networking/Network Models, TCP, UDP & Ports

What is the difference between a socket, a connection and a port?

BeginnerConceptNetwork Models, TCP, UDP & Ports
Answer

A socket is an endpoint: an IP plus a port plus protocol, represented as a file descriptor in the process. A listening socket waits on one port; each accepted connection gets its own new socket, but they all share the same local port and are distinguished by the remote IP and port.

That is why one server on port 443 can hold hundreds of thousands of connections. The limits are file descriptors, memory and conntrack, not the number of ports.

All Networking questions Roadmap: Networking for DevOps

More on Network Models, TCP, UDP & Ports