CSC8021_computer network_The Transport Layer

Role of the transport layer

• The transport layer is responsible for providing a reliable end-to-end connection between two application processes in a network

• Abstracting away the physical subnet

• Does not involve intermediate nodes

• Takes a network address (IP) and transport address (port) to ensure packets are received by the desired service

·传输层负责在网络中的两个应用进程之间提供可靠的端到端连接

·抽象出物理子网

·不涉及中间节点

·获取网络地址(IP)和传输地址(端口),以确保数据包被所需的服务接收

Comparison with other OSI layers

• Much of the functionality of the Transport and Datalink layers are the same but with any complex network between hosts abstracted away

• The Network layer is run by communications providers while the Transport layer is run by communicating hosts

·传输层和数据链路层的大部分功能都是相同的,但主机之间的任何复杂网络都被抽象掉了。

·网络层由通信提供商运行,而传输层由通信主机运行

Well known ports

• Well known ports are (usually) assigned to a standard service that a

system offers.

• In combination with an IP, the port is used to move packets from the network to the desired application layer service. An example might be

127.0.0.1:22 for SSH

• This combination of IP + port is called a socket

·众所周知的端口(通常)被分配给标准服务,系统报价。

·与IP结合,端口用于将数据包从网络移动到所需的应用层服务。一个例子可能是127.0.0.1:22用于SSH

·这种IP +端口的组合称为套接字

Transport protocol data unit (TPDU)

• Used to encapsulate transport layer data

• Passed to the Network layer, which is passed to the Datalink layer, which is passed to the Physical layer, sent across a network, then back up the stack and unwrapped

·用于封装传输层数据

·传递到网络层,然后传递到数据链路层,再传递到物理层,通过网络发送,然后备份堆栈并解包

Unicast vs Multicast vs Broadcast

• Unicast is a one-to-one transmission from one node in a network to another

• Multicast is a one-to-many transmission from one node in a network to many selected nodes

• Broadcast is a one-to-all transmission from one node to all other nodes on the network

·单播是从网络中的一个节点到另一个节点的一对一传输

·多播是从网络中的一个节点到许多选定节点的一对多传输

·广播是从网络上的一个节点到所有其他节点的一对多传输

Transport protocols

• There are two commonly supported transport layer protocols

  1. Transmission Control Protocol (TCP)
  2. User Datagram Protocol (UDP)
    • UDP is connectionless (also called fire and forget) and consequentially faster than TCP
    -- Used for real-time services (DNS lookup, online gaming, video streaming)
    • TCP is connection oriented and while slower is more reliable
    -- Used for transfers that cannot fail (email, webpages, file transfers)
    ·有两种通常支持的传输层协议
    1.传输控制协议(TCP)
    2.用户数据报协议(UDP)
    UDP是无连接的(也称为fire and forget),因此比TCP快。
  • 用于实时服务(DNS查找、在线游戏、视频流)
    · TCP是面向连接的,速度越慢越可靠
  • 用于不会失败的传输(电子邮件、网页、文件传输)

User Datagram Protocol (UDP)

• Designed for "one request, one response" applications where setting up a connection is too much work

• An unreliable transport protocol

• UDP is not very popular but has its use cases

• "IP with extra header"

• Many systems reject UDP on non-standard ports by default

·专为"一个请求,一个响应"的应用程序,其中设置连接是太多的工作

·不可靠的传输协议

UDP不是很流行,但有它的用例

·"IP with extra header"

·许多系统默认拒绝非标准端口上的UDP

Transmission control protocol (TCP)

• Designed to be robust under unreliable internet conditions

• Provides end-to-end connection

• Utilises a 3-way handshake for connection

• Utilises a sliding window protocol for flow control

·在不可靠的互联网条件下保持稳定

·提供端到端连接

·使用3次握手进行连接

·利用滑动窗口协议进行流控制

3-Way handshake

The TCP 3-Way Handshake prevents duplicate connections,and allows the nodes to reject spurious packets

  1. SYN (sync)
  2. SYN/ACK
    (sync/acknowledged)
  3. ACK (acknowledged)
    At this point x becomes the starting sequence number for the sender, and y becomes the starting sequence number for the receiver
    TCP 3-Way Handshake防止重复连接,并允许节点拒绝虚假数据包
  4. SYN(同步)
  5. SYN/ACK
    (sync/确认)
  6. ACK(已确认)
    此时,x成为发送方的起始序列号,y成为接收方的起始序列号

Flow control

• TCP operates a sliding window mechanism where each acknowledge includes the amount of data the receiver is now willing to accept.

• A number of measures are commonly employed to ensure that the window size is roughly a multiple of the senders desired segment size.

• Different flow control schemes are one of the main differences between different versions of TCP used today (there are several).

TCP采用滑动窗口机制,其中每个确认包括接收方现在愿意接受的数据量。

·通常采用许多措施来确保窗口大小大致为所需分段大小的倍数。

不同的流量控制方案是当今使用的TCP不同版本之间的主要差异之一(有几个)。

Sliding window

• Sender sends 2048 bits to start

• Receiver's buffer has capacity so it acks the send and sets the window

• Sender sends the same amount which fills receiver's buffer

• Receiver acks the send and sets the window to 0 until the buffer is cleared

• Receivers buffer gets cleared 2048 bits so it acks the last send again and sends the new window

·UART发送2048位启动

·接收方的缓冲区有容量,因此它确认发送并设置窗口

·发送器发送与填充接收器的缓冲区相同的量

·接收方确认发送并将窗口设置为0,直到缓冲区被清除

·接收器缓冲区被清除2048位,因此它再次确认最后一次发送并发送新窗口

UDP vs TCP

UDP

• Connectionless

• Unicast, Multicast, or Broadcast communication

• No guarantees (packets may be lost, out of order,dropped)

• Faster due to "fire and forget" model

TCP

• Connection oriented

• Unicast communication

• Data delivery guarantees

-- Packets arrive in order

-- Duplicate packets are rejected

-- Dropped packets are retransmitted

• Slower due to connection overhead

• Can deal with congestion

UDP

·无连接

·单播、多播或广播通信

·无保证(数据包可能丢失、乱序、丢失)

·更快,因为"火灾和遗忘"模式

TCP

·面向连接

·单播通信

·数据传输保证

  • 数据包按顺序到达

  • 拒绝重复的数据包

  • 重传丢弃的数据包

·由于连接开销而变慢

·可以处理拥塞

TCP congestion control - slow start

In order to deal with packet congestion,TCP utilises an algorithm called slow start

  1. Window starts at 1 max segment(TDPU) size
  2. Doubles window each time an ack is received, exponential increase
  3. When a packet is lost (congestion), the window reverts to 1 max segment and the process starts from step 1 again
    为了处理数据包拥塞,TCP使用一种称为慢启动的算法
    1.窗口从1个最大段(TDPU)大小开始
    2.每次接收到ACK时将窗口加倍,指数增加
    3.当数据包丢失(拥塞)时,窗口恢复为最大1个段,过程再次从步骤1开始。

TCP congestion control - threshold

Another way TCP deals with congestion is by utilising a threshold

  1. Window starts at 1 max segment(TDPU) size
  2. State some threshold (e.g. 32k) and double the window each time an ack is received until it is reached
  3. Once threshold is met, linearly increase window size
  4. When a packet is lost (congestion) reset threshold to ½ current window and the process starts from step 1 again
    TCP处理拥塞的另一种方法是利用阈值
    1.窗口从1个最大段(TDPU)大小开始
    2.规定某个阈值(例如32 k),并在每次收到确认时将窗口加倍,直到达到该阈值
    3.一旦达到阈值,则线性增加窗口大小
    4.当数据包丢失(拥塞)时,将阈值重置为当前窗口的1/2,并再次从步骤1开始处理
相关推荐
墨水\\5 分钟前
Ansible部署及基础模块
服务器·网络·ansible
七七powerful9 分钟前
ansible play-book玩法
linux·服务器·ansible
晚安,cheems15 分钟前
linux的权限
linux·运维·服务器
路溪非溪16 分钟前
Linux加载一个应用程序的过程总结
linux·运维·服务器
手心里的白日梦18 分钟前
网络计算器的实现:TCP、守护进程、Json、序列化与反序列化
网络·tcp/ip·json
不吃鱼的羊24 分钟前
Excel生成DBC脚本源文件
服务器·网络·excel
敲代码娶不了六花29 分钟前
对计算机网络中“层”的理解
网络·网络协议·tcp/ip·计算机网络
Graceful_scenery40 分钟前
https双向认证
服务器·网络·网络协议·http·https
FBI780980459440 分钟前
API接口在电商行业中的创新应用与趋势
运维·网络·人工智能·爬虫·python
希雅不是希望1 小时前
Ubuntu命令行网络配置
网络·ubuntu·php