当前位置:
文档之家› 网络通信_ch7_数据链路控制
网络通信_ch7_数据链路控制
6
询问/应答方式的流程图 询问 应答方式的流程图
A站 B站
ENQ ACQ
ENQ=Enquiry ACQ=Acknowledge 数 据
应 答
数 据 应 答 传 结 输 束
时 间
时 间
7
2.
轮询/选择模式 轮询 选择模式
这种模式用于多点设备结构,但其中某一个为主设备, 这种模式用于多点设备结构,但其中某一个为主设备,其余的 多点设备结构 为从设备。 为从设备。 主设备:控制链路,总是会话的发起者; 主设备:控制链路,总是会话的发起者; 从设备:遵从住设备的指令; 从设备:遵从住设备的指令; 工作方式: 工作方式: 主设备有数据发送, (1)选择方式 主设备有数据发送,告知从设备准备好接收; )选择方式—主设备有数据发送 告知从设备准备好接收; 主设备希望接收数据, (2)轮询方式 主设备希望接收数据,询问从设备有无数据待发。 )轮询方式—主设备希望接收数据 询问从设备有无数据待发。 -
Bilingual Course
Network Communications 网络通信
(For Master Students in the Department of Electronic Engineering)
Chapter 7 Data Link Control
Instructor: Dr. Tianshuang Qiu
• 流量控制的方法
(1)停止等待流量控制(Stop-and-Wait Flow Control) )停止等待流量控制( ) (2)滑动窗流量控制(Sliding Window Flow Control) )滑动窗流量控制( )
A 主 备 设
B
C
-
地址: 地址: · 链路上每个设备有自己的名字或地址; 链路上每个设备有自己的名字或地址; · 每次传输,数据帧中会建立地址部分(称为地址域或称为报 每次传输,数据帧中会建立地址部分( 头)
8
(1) 选择模式 当主设备有数据要发送时: 当主设备有数据要发送时: - 通知从设备准备好接收; 通知从设备准备好接收; - 等待从设备的回答; 等待从设备的回答; - 发送数据之前,主设备产生 发送数据之前, 一个选择祯( ),其中包 一个选择祯(SEL),其中包 ), 含一个地址域, 含一个地址域,填入要发送的 从设备的地址; 从设备的地址; - 当数据沿着链路发送时,任 当数据沿着链路发送时, 何一个从设备均有可能接收到 此数据。 此数据。各个从设备都校验数 据中的地址域; 据中的地址域; - 若与自己的一致,则读入; 若与自己的一致,则读入; - 若不一致,则放弃 若不一致,
4
数据链路控制的要求和目标
• Frame synchronization: Data are sent in blocks called frames. The beginning and end of each frame must be recognizable. • Flow control: The sending station must not send frames at a rate faster than the receiving station can absorb them. • Error control: Bit errors introduced by the transmission system should be corrected. • Addressing: On a multipoint line, such as a local area network (LAN), the identity of the two stations involved in a transmission must be specified. • Control and data on same link: It is usually not desirable to have a physically separate communications path for control information. Accordingly, the receiver must be able to distinguish control information from the data being transmitted. • Link management: The initiation, maintenance and termination of a sustained(持续的)data exchange requires a fair amount of (持续的) coordination and cooperation among stations. Procedures for the management of this exchange are required. 5
School of the Electronic and Information Engineering
Fall of 2009
1
Outline
• Because of the possibility of transmission errors, and because the receiver of data may need to regulate the rate at which data arrive, synchronization and interfacing are insufficient. It is necessary to impose a layer of control that provides functions such as flow control, error detection, and error control. This layer is known as data link control protocol. • Flow control enables a receiver to regulate the flow of data from a sender so that the receiver’s buffers do not overflow. • Error detection is performed by calculating an error-detecting code that is a function of the bits being transmitted. The code is appended to the transmitted bits. The receiver calculates the code based on the incoming bits and compares it to the incoming code to check for errors. • In data link control, error control is achieved by retransmission of damaged frames.
§7-1 线路规程
• 三种方式
1. 询问/应答模式( 询问 应答模式(Enquiry/ Acknowledge) 应答模式 )
常在专用链路中使用; 常在专用链路中使用; 负责协调哪个设备可以开始传输 工作方式: 工作方式: ),问接收方是否可以接收数据 (1)启动方发一个询问帧(ENQ),问接收方是否可以接收数据; )启动方发一个询问帧( ),问接收方是否可以接收数据; 2)若接收方准备好,回答一个确认帧(ACK),若未准备好, ),若未准备好 (2)若接收方准备好,回答一个确认帧(ACK),若未准备好, 则回答一个否定帧( 则回答一个否定帧(NAK); ); ),则再发一次 (3)若未收到回答(等待一定时间),则再发一次(一般发三 )若未收到回答(等待一定时间),则再发一次( 次); (4)若回答为否定,或三次都无回答,则断开连接。在另一时刻 )若回答为否定,或三次都无回答,则断开连接。 再重新开始; 再重新开始; (5)若回答肯定,启动方就可以随时发送数据了; )若回答肯定,启动方就可以随时发送数据了; (6)发完时,发方传一个结束帧(EOT) )发完时,发方传一个结束帧( )
• 线路规程
– 解决现在时刻该谁发送的问题
• 流量控制
– 负责调整某个时间间隙中可以发送多少数据。使接收方能够 负责调整某个时间间隙中可以发送多少数据。 调整来自发送方的数据流,以防止接收方出现溢出。 调整来自发送方的数据流,以防止接收方出现溢出。
• 差错控制
– 检测和纠正传输错误。 检测和纠正传输错误。 – 差错检测的实现:依靠差错检测码的计算实现,它是传输比 差错检测的实现:依靠差错检测码的计算实现, 特的一个函数。差错检测码通常附加在传输的数据位之后。 特的一个函数。差错检测码通常附加在传输的数据位之后。 接收方根据接收到的比特计算出差错检测码, 接收方根据接收到的比特计算出差错检测码,然后将其与收 到的差错检测码比较,以检查是否有差错。 到的差错检测码比较,以检查是否有差错。 – 差错控制的实现:通过重传损坏帧来实现。 差错控制的实现:通过重传损坏帧来来自现。A 主设备B
C
SEL ACK 数 据 应答
时 间 选择 C
时间
9
(2) 轮询模式 主设备请求从设备发送数据。 主设备请求从设备发送数据。
A 主 备 设 B C
轮 询 否 应 定 答 ENQ 数 据 应 帧 答 ENQ 否 应 定 答
时 间
时 间
10
§7-2 流量控制
• 为什么要进行流量控制
– Flow control is a technique for assuring that a transmitting entity does not overwhelm a receiving entity with data. The receiving entity typically allocates a data buffer of some maximum length for a transfer. When data are received, the receiver must do a certain amount of processing before passing the data to the higher level software. In the absence of flow control, the receiver’s buffer may fill up and overflow while it is processing old data.