Chapter12 TCP:The Transmission Protocol(Preliminaries)

news/2024/12/14 12:39:42/

文章目录

  • 12 TCP: The Transmission Protocol(Preliminaries)
    • 12.1 Introduction
      • 12.1.1 ARQ and Retransmission
      • 12.1.2 Windows of Packets and Sliding Windows
      • 12.1.3 Variable Windows: Flow Control and Congestion Control
      • 12.1.4 Setting the Retransmission Timeout
    • 12.2 Introduction to TCP
      • 12.2.1 The TCP Service Model
      • 12.2.2 Reliability in TCP
    • 12.3 TCP Header and Encapsulation

12 TCP: The Transmission Protocol(Preliminaries)

12.1 Introduction

The foundation of Information theory was created by Claude Shannon in 1984 provide a inspiration for information error handle:

  1. error-correcting
  2. ARQ (Automatic Repeat Request)

12.1.1 ARQ and Retransmission

There maybe encounter some information problems in the communication in multihop cascade of several:

  1. packet reordering
  2. packet duplication
  3. 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 M / R M/R M/R,
    • M M M​ : packet size; R R R: round-trip time(RTT)
    • For a fixed-size packet, as R R R​ 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:

  1. when to inject packet into network
  2. how long for timer to waiting ACK
  3. keep the packet copy for retransmission

Receiver need to consider:

  1. distinguish repeated packet
  2. Maintain a sophisticated buffering(Packet Storage): hold “out-of-sequence”(The packet is not away coming in order or completely)

Other issue:

  1. Receiver is slower than the sender.(Receiver will drop the packet because can’t dispose overwhelming packet from sender)
  2. 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:

  1. Rate-based flow control: fixed rate allocation which not allow be exceeded.
  2. Window-based flow control: dynamic rate
    1. Window advertisement(or window update): the method to signal the sender how large a window to use.
    2. Window advertisement and ACK are together in single packet in practical.

Transfer rate: S W / R SW/R SW/R

  1. S S S: packet size in bits
  2. W W W: window size
  3. R R R: 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.


  1. CWR Congestion Window Reduced(The sender reduced its send rate)
  2. ECE ECN Echo(the sender received an earlier congestion notification)
  3. URG Urgent(The Urgent Pointer field is valid — rarely used)
  4. ACK Acknowledge (The Acknowledge Number field is valid — always on after a connection is established)
  5. PSH Push (The receiver should pass this data to the application as soon as possible — not reliably implemented or used)
  6. RST Rest the connection (connection abort, usually because of an error)
  7. SYN Synchronize sequence numbers to initiate a connection
  8. FIN The sender of the segment is finished sending data to its peer

http://www.ppmy.cn/news/628657.html

相关文章

ROS+Gazebo中红绿黄交通灯如何实现?

红灯: 绿灯: 黄灯: 交通灯车道识别,是最简单的自动驾驶仿真。 参考代码如下: #include "GazeboTrafficLight.hpp"namespace gazebo {GazeboTrafficLight::GazeboTrafficLight() {sequence_timestamp_ 0.0;…

idea 用maven打包报错:After correcting the problems, you can resume the build with the command

问题大概: IDEA After correcting the problems, you can resume the build with the command解决方案“ 之前使用的是USE JAVA_HOME,修改成项目的就可以成功build project了。

error: expected declaration specifiers or ‘...’ before numeric constant

今天遇到了这个错误&#xff0c;很奇怪&#xff0c;最终解决了。 可以产生这个错误的示例代码如下&#xff1a; #include <stdio.h>#define VALUE 1int func(int a) {printf("%d\n",a);return 0; }int main() {int func(VALUE);return 0; }编译&#xff1a; …

consider的用法

consider的用法 consider大致有两种含义。含义不同&#xff0c;用法有别。现归纳如下。 一&#xff0e;consider作“考虑”解&#xff0c;常用于以下句型&#xff1a;1&#xff0e; Consider名词/代词/动名词。 You’d better consider my suggestion. 你最好考虑我的建议。I…

【CVPR2020】Semi-Supervised Semantic Image Segmentation with Self-correcting Networks

Abstract 摘要Introduction 介绍Method 方法Ancillary Segmentation Model 辅助分割模型Self-correction module自校正模块No self-correction module 无自校正模块Linear self-correction module 线性自校正模块Convolutional self-correction module 卷积自校正模块 Experien…

Sklearn中的二分类模型可以进行多分类的原理

Sklearn中的二分类模型可以进行多分类的原理 二分类扩展到多分类的方法 从sklearn的源码中可以找到sklearn将二分类模型推广到多分类模型的具体做法&#xff1a; 即比较常用的&#xff1a; one-vs-rest&#xff08;一对多&#xff09;one-vs-one&#xff08;一对一&#xff…

【上篇】Python实现最短路问题常见求解算法——Label Correcting Algorithm(deque)

基于python语言&#xff0c;实现deque label correcting 算法对最短路问题&#xff08;Shortest Path Problem&#xff09;进行求解。 目录 1. 适用场景2. 算法说明3. 测试网络4. 代码实现5. 求解结果6. 代码及数据文件参考 1. 适用场景 无负环网络起点与终点间至少存在一条可…

ECC校验——汉明码(Hamming Code)

本文参考板块与链接&#xff1a; https://en.wikipedia.org/wiki/Hamming_code #wiki英文版 https://zh.wikipedia.org/wiki/%E6%B1%89%E6%98%8E%E7%A0%81 #wiki中文版 前言 本文主旨意在讲清如何根据原理构造常用的汉明码&#xff0c;鉴于本人在网络查阅资料过程翻阅大量低效/…