We know TCP socket is port numbers and IP addresses. Is TCP socket connection is 3-way handshake:the SYN packet, the SYN-ACK packet, and the ACK packet?
Is TCP socket connection follows TCP stack?
And is TCP connection follows the TCP stack for data transmission?
My question is how TCP stack, TCP connection and TCP socket connection are interrelated? And how could we differentiate them? And socket connection uses IP address at later that is responsible by OS?
Best Answer
A TCP connection is identified by a pair of sockets (local and remote). Connecting to a remote TCP and handshaking gives you a bidirectional connection. It is like a pair of pipes (one in each direction) between the hosts, and anything going in one end of a pipe comes out the other end.
RFC 793, Transmission Control Protocol explains (see highlights, but the RFC goes into much more detail):