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

Describe the TCP three-way handshake.

BeginnerConceptNetwork Models, TCP, UDP & Ports
Answer

Client sends SYN with its initial sequence number, server replies SYN-ACK with its own sequence number and acknowledges the client's, client sends ACK. After that the connection is ESTABLISHED on both sides and data can flow.

Client -> Server : SYN, seq=x
Server -> Client : SYN, ACK, seq=y, ack=x+1
Client -> Server : ACK, ack=y+1

It costs one full round trip before the first byte of data (two with TLS 1.2 on top), which is why connection reuse matters.

All Networking questions Roadmap: Networking for DevOps

More on Network Models, TCP, UDP & Ports