-
Transmission Control Protocol (TCP)
- characteristics:
- connection-oriented
- full-duplex
- reliable
- byte-stream protocol
- connection-oriented
-
functions:
- characteristics:
-
retransmission timeout (RTO)
-
- (Jacobson & Karels)
- (typical values: , )
-
fast retransmit
- when a sender receives 3 duplicate ACKs (4 identical ACKs in total) for the same segment, it assumes the subsequent segment was lost in transit. Instead of waiting for the timer to run out, the sender immediately retransmits the missing segment.
-
maximum segment lifetime (MSL)
- (120 seconds by RFC 793)
-
silly window syndrome (SWS)
-
(given we want create a layer-4 protocol similar to TCP, where and are the nubmer of bits in the sequence number field and in the window size field (resp.))
- has to be hold to ensure that a sequence number does not “wrap around” and get reused while an old segment with that same number might still be drifting through the network
- has to be hold to achieve maximum throughput and keep the “pipe” full
-
TCP Fast Open (TFO)
header
-
(1st word)
- Source port
- Destination port
-
(2nd word)
- sequence number identifies byte positions
- when , it represents the initial sequence number; actual data starts at sequence number + 1.
- when , it represents the sequence number of the first data byte in the segment.
- sequence number identifies byte positions
-
(3rd word)
- acknowledgment number specifies the next sequence number expected, thereby acknowledging receipt of all preceding bytes. (cumulative acknowledgment, an ACK confirms everything up to byte )
- valid when
- acknowledgment number specifies the next sequence number expected, thereby acknowledging receipt of all preceding bytes. (cumulative acknowledgment, an ACK confirms everything up to byte )
-
(4th word)
- data offset (DOffset) (TCP header length) in 4-byte words
- min: 5
- max: 15
- reserved (3 bits)
- flags:
- ACK (acknowledgment): indicates that the acknowledgment number is valid and the sender is confirming receipt of data.
- SYN (synchronize): used to initiate a connection by synchronizing sequence numbers between hosts.
- FIN (finish): indicates that the sender has no more data to send and requests connection termination.
- receive window size (in bytes)
- the rwnd the receiver advertises (specifies the number of bytes the receiver allows the sender to transmit before needing an acknowledgment)
- when window size = 0,
- the rwnd the receiver advertises (specifies the number of bytes the receiver allows the sender to transmit before needing an acknowledgment)
- data offset (DOffset) (TCP header length) in 4-byte words
-
(5th word)
- checksum
- urgent pointer
-
(6th+ word(s))
- options
- (each option has: kind (8 bits), length (8 bits) and value (16 bits))
- maximum segment size (MSS) - the maximum amount of TCP payload data (in bytes) that can be carried in the TCP segment
- (theoretical) (bytes)
- (practical)
- selective acknowledgement (SACK)
- window scaling
- used only during the three-way handshake
- options
-
SYN and SYN-ACK segments
- can carry data by specification, but in practice they do not
- consume one sequence number.
-
ACK segments (if they contain no data)
- do not consume sequence numbers
- are not acknowledged
sliding window
- receive window (rwnd)
- advertised window
- congestion window (cwnd)
operation
- Transitions are labeled with event/action:
- event causing the transition
- action resulting from the transitions
(source: commons.wikimedia.org)
Connection establishment
(source: commons.wikimedia.org)
- Connection establishment using three-way handshake:
- SYN
- SYN-ACK
- ACK
Connection termination
-
Connection termination using four segments:
- FIN
- ACK
- FIN
- ACK
-
TIME_WAIT is lasting for 2MSL
(source: commons.wikimedia.org)