1.2) Building Blocks of TCP Flashcards
Internet Protocol (IP)
Provides host-to-host routing and addressing.
Transmission Control Protocol (TCP)
Provides abstraction of a reliable network running over an unreliable channel.
TCP streams guarantee that all bytes sent will be identical with bytes received and that they will arrive in the same order to the client.
Three-Way Handshake
Before the client or the server can exchange any application data, they must agree on starting packet sequence numbers as well as a number of other connection specific variables, from both sides.
SYN
The first packet sent in the three-way handshake. The client picks a random sequence number x and sends a SYN packet, which may also include additional TCP flags and options.
SYN ACK
The second packet sent in the three-way handshake. The server increments x (sent by the client) by one, picks own random sequence number y, appends its own set of flags and options, and dispatched the response.
ACK
The third packet sent in the three-way handshake. The client increments both x and y (sent by the server) by one and completes the handshake by dispatching the last ACK packet in the handshake.
Connection Reuse
The delay imposed by the three-way handshake makes new TCP connections expensive to create, and is one of the big reasons why connection reuse is a critical optimization for any application running over TCP.
TCP Fast Open (TFO)
A mechanism that aims to reduce latency penalty imposed on new TCP connections by allowing data transfer within the SYN packet.
“congestion collapse”
A condition discovered in 1984 which could affect any network with asymmetric bandwidth capacity between the nodes.
To address these issues, multiple mechanisms were implemented in TCP to govern the rate with which the data can be sent in both directions: flow control, congestion control, and congestion avoidance.
Flow Control
A mechanism to prevent the sender from overwhelming the receiver with data it may not be able to process.
Each side of the TCP connection advertises its own receive window (rwnd), which communicates the size of the available buffer space to hold the incoming data.
Each ACK packet carries the latest rwnd value for each side, allowing both sides to dynamically adjust the data flow rate to the capacity and processing speed of the sender and receiver.
Window Scaling (RFC 1323)
RFC 1323 was drafted to provide a “TCP window scaling” option, which allows us to raise the maximum receive window size from 65,535 bytes to 1 gigabyte.
Enabled by default of all major platforms today.