Chapter 12 TCP: The Transmission Protocol(Preliminaries)
The foundation of Information theory was created by Claude Shannon in 1984 provide a inspiration for information error handle:
- ARQ (Automatic Repeat Request)
12.1.1 ARQ and Retransmission
There maybe encounter some information problems in the communication in multihop cascade of several:
- packet reordering
- packet duplication
- packet erasures(drops)
TCP is an error-correcting protocol which will cope with these problems above.
Packet reordering and duplication solution
Packet erasure(drops) solution:
- TCP is reliable but inefficient.
- Stop and wait: sender inject single packet into communication path and have to waiting ACK.
- Throughput performance: data sent on the network per unit time. It is proportional to ,
- : packet size; : round-trip time(RTT)
- For a fixed-size packet, as goes up⤴️ , the throughput goes down⤵️ .(Assuming not packet lose or damaged in transit)
- The network in idle also have lower efficiency.
Sender need to consider:
- when to inject packet into network
- how long for timer to waiting ACK
- keep the packet copy for retransmission
Receiver need to consider:
- distinguish repeated packet
- Maintain a sophisticated buffering(Packet Storage): hold “out-of-sequence”(The packet is not away coming in order or completely)
- Receiver is slower than the sender.(Receiver will drop the packet because can’t dispose overwhelming packet from sender)
- Network infrastructure(e.g. routers in middle) can’t copy with rate of data the sender and receiver wish to use.
12.1.2 Windows of Packets and Sliding Windows
window: the collections of packets which have been sent but not yet be acknowledged.
window size: number of packets in the window.
💬 Window is like canteen window which controls who be serviced and have three state: not yet service/servicing/serviced.
Window can combat many problems:
- At sender:
- what packets can be release.
- what packet are awaiting ACK.
- what packets cannot yet be send.
- At receiver:
- what packets have been received and acknowledge.
- what packets are expected.
- how much memory has been allocated to hold them.
Still not resolve:
- how large the window should be.
- data transfer rate.
12.1.3 Variable Windows: Flow Control and Congestion Control
Flow Control: the way to force sender slow down. Two type:
- Rate-based flow control: fixed rate allocation which not allow be exceeded.
- Window-based flow control: dynamic rate
- Window advertisement(or window update): the method to signal the sender how large a window to use.
- Window advertisement and ACK are together in single packet in practical.
- : packet size in bits
- : window size
- : RTT
Congestion Control: the special form of flow control which copy with the data transfer rate between sender and receiver.
❓ The problem of congestion control in datagram-style networks, and more generally queuing theory to which it is closely related, has remained a major research topic for years, and it is unlikely to ever be solved completely for all circumstances.
Explicit signaling: have a protocol specific field. e.g. window advertisement.
Implicit signaling: need other evidence.
12.1.4 Setting the Retransmission Timeout
Retransmission timeout: the time to wait before concluding that a packet has been lost and should be resend.
To determine retransmission timeout:
- the time to send the packet.
- the time receiver process it and send an ACK.
- the time for ACK travel back to the sender.
- the time sender process the ACK.
😭 None of these time are known with certainty!
😫 These time vary over time as additional load is added to or removed from the end hosts or routers.
Round-trip-time estimation: try to estimate the time which can’t exactly get but approximately approach.
The timeout is large than time by round-trip-time estimation.
12.2 Introduction to TCP
12.2.1 The TCP Service Model
TCP provide a connection-oriented, reliable, byte streaming service.
- Connection-oriented: Two endpoint have to establish a TCP connection before exchange data.
- Byte streaming: Each endpoint individually choose write or read extent.
12.2.2 Reliability in TCP
Packetization take the sending application’s stream of bytes into a packet that IP can carry.
- Packet contain sequence number which allow packet have arbitrary size.
Repacketization combine packets.
Segment The chunk from sending application’s data separated by TCP.
TCP maintain a mandatory checksum on its header, any associated application data, and fields from the IP header.
The receiving packet may acknowledge previous packet so as to help the sender with its congestion control computation.
🔵 A group of segments own one timer
➡️ Timer set when window of data are sent
➡️ Timeout update when receive acknowledge
↪️ Retransmission if acknowledge not be receive in time.
Receiver not send acknowledge immediately and it will delay a fraction of second.
The ACKs used by TCP are cumulative in the sense that an ACK indicating byte number N implies that all bytes up to number N(but not including it) have already received successfully.
If an ACK packet loss, a subsequent ACK are sufficient to acknowledge the previous segment.
IP protocol didn’t provide duplicate elimination or guarantee correct ordering.
TCP will maintain a large sequence number in order to provide integral and correct order data to application.
12.3 TCP Header and Encapsulation
The length of TCP Header:
- 20 bytes;
- 60 bytes with options.
TCP Data is optional. Without TCP Data:
- Pure ACK just to acknowledge the receive data.
- Window update just to change the window size.
Source Port & Destination Port + IP address: Socket
TCP numbers each byte with a sequence number
SYN segment: TCP initial connection segment which not using 0 or 1 rather then a random number(initial sequence number(ISB)) as sequence number because of secure measure.
ACK don’t consume sequence number.
- CWR Congestion Window Reduced(The sender reduced its send rate)
- ECE ECN Echo(the sender received an earlier congestion notification)
- URG Urgent(The Urgent Pointer field is valid — rarely used)
- ACK Acknowledge (The Acknowledge Number field is valid — always on after a connection is established)
- PSH Push (The receiver should pass this data to the application as soon as possible — not reliably implemented or used)
- RST Rest the connection (connection abort, usually because of an error)
- SYN Synchronize sequence numbers to initiate a connection
- FIN The sender of the segment is finished sending data to its peer