Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Networks and Internets 《计算机网络与因特网》课件 林坤辉 2004-02-6.

Similar presentations


Presentation on theme: "Computer Networks and Internets 《计算机网络与因特网》课件 林坤辉 2004-02-6."— Presentation transcript:

1 Computer Networks and Internets 《计算机网络与因特网》课件 林坤辉 2004-02-6

2 PART II Packet Transmission Chapter 7 Packets, Frames, and Error Detection and Error Detection 包、帧与差错检测 包、帧与差错检测

3 7.1 Introduction

4 电路交换

5 分组交换

6

7

8

9 7.2 The Concept of Packets The network system divides data into small blocks called packets,which it sends individually. Computer networks are often called packet networks or packet switching networks because they use packet technology.

10 Two facts motivate the use of packets: First, a sender and receiver need to coordinate transmission to ensure that data arrives correctly. When transmission errors occur, data can be lost. Dividing the data into small blocks helps a sender and receiver determine which blocks arrive intact and which do not.

11 Second, because multiple computer often share underlying connections and hardware, a network system cannot allow one computer to deny access to others. Using small packets helps ensure fairness.

12 How long does a file transfer require? If a file contains 5 megabytes and the communication system can transfer 56,000 bits per second.

13 7.3 Packets and Time-Division Multiplexing A network that permits many sources to take turns accessing a shared communication resource is providing a form of time-division multiplexing.

14

15 7.4 Packets and Hardware Frames The term packet refers to the general concept of a small block of data, there is no universal agreement on the exact format of packet. Each hardware technology defines the details of packets that can be transferred on that hardware, and specifies how individual bits of the packet are transmitted. We use the term frame to denote the definition of a packet used with a specific type of network.

16 RS-232 standard is a character-oriented transmission scheme, but it does not include a mechanism that allows the sender to signal the end of a block of characters RS-232 standard is a character-oriented transmission scheme, but it does not include a mechanism that allows the sender to signal the end of a block of characters

17 7.5 Byte Stuffing 字节填充 7.5 Byte Stuffing 字节填充 Although using characters to mark the beginning and end of each frame has advantages, most computer networks cannot afford to reserve characters for use by the network. The network permits an application to transfer arbitrary characters across the network.

18 To distinguish between data being sent and control information such as frame delimiters, network systems arrange for the sending side to change the data slightly before it is sent, and then arrange for the receiving side to restore the original data before passing it to the receiving application. To distinguish between data being sent and control information such as frame delimiters, network systems arrange for the sending side to change the data slightly before it is sent, and then arrange for the receiving side to restore the original data before passing it to the receiving application. Because network systems usually insert extra bits or bytes to change data for transmission, the technique is known as data stuffing. Because network systems usually insert extra bits or bytes to change data for transmission, the technique is known as data stuffing.

19 The term byte stuffing and character stuffing refer to data stuffing used with character-oriented hardware, and bit stuffing refers to data stuffing used with bit-oriented hardware. For example: The term byte stuffing and character stuffing refer to data stuffing used with character-oriented hardware, and bit stuffing refers to data stuffing used with bit-oriented hardware. For example:

20

21 字符填充

22 位填充

23

24 7.6 Transmission Errors 传输差错 Lightning,power surges,and other electro-magnetic interference can introduce unwanted electrical currents in the electronic components or wires used for communication. Called transmission errors, the problems of lost, changed, or spuriously appearing bits account for much of the complexity needed in computer networks.

25

26

27 7.7 Parity Bits and Parity Checking 奇偶位与奇偶校验 Known as a parity check, the mechanism requires the sender to compute an additional bit, called a parity bit, and to attach it to each character before sending. After all bits of a character arrive, the receiver removes the parity bit. There are two forms of parity: even and odd.

28 0000 0 0001 1 0010 1 0011 0 0000 1 0001 0 0010 0 0011 1 信息位校验位 信息位校验位 偶校验奇校验

29 7.8 Probability, Mathematics, and Detection 差错检测中概率和数学 A parity scheme which is designed to help detect transmission errors, sends one extra bit of information with each character. Although it allows a receiver to determine if a single bit has been changed, parity cannot detect transmission errors that change an even number of bits.

30 Differences among the mechanisms arise in three ways: 1) The size of the additional information; 2) The computational complexity of the algorithm; 3) The number of bit errors that can be detected All error detection methods are approximate The goal is to expend a reasonable effort to produce a low probability of accepting corrupted data.

31 7.9 Detecting Errors With Checksums Many computer network systems send a checksum( 校验和 ) along with each packet to help the receiver detect errors. To compute a checksum, the sender treats each pair of characters as a 16- bits integer and computes the sum. If the sum grows larger than 16 bits, the carry bits( 进位 ) are added into the final sum.

32 The small size of the checksum means the cost of transmitting the checksum is usually much smaller than the cost of transmitting the data.

33 Checksums have the disadvantage of not detecting all common errors. For example:

34 7.10 Detecting Errors With Cyclic Redundancy Checks 用循环冗余校验检测差错 How can a network system detect more errors without increasing the amount of additional information in each packet? The answer lies in CRC techniques. Hardware that calculates a CRC uses two simple components: a shift register( 移位寄存器 ) and an exclusive or (xor 异或 ) unit

35

36

37 7.11 Combining Building Blocks Three shift registers and three exclusive or units can be combined to compute a 16_bit CRC.

38 补充 可以用软件实现 CRC.

39

40

41

42

43 用多项式 表示除数

44 7.12 Burst Errors 突发错误 Two categories of common errors make CRCs especially useful. First, hardware failures sometimes cause a specific set of bits to be damaged. for example , vertical errors( 垂直错误 ) Second, CRCs are especially useful for detecting errors that involve changes to a small set of bits near a single location.such errors are called burst errors( 突发错误 ).

45 7.13 Frame Format and Error Detection Mechanisms Network usually associate error detection information with each frame. The sender calculates information such as a checksum or CRC, and transmits the additional information along with the data in the frame. The receiver calculates the same value and compares it to the additional information that arrives in the frame.

46 For example: No error detection scheme is perfect because transmission errors can affect the additional information as well as the data.

47 作业 课本: 7.1, 7.2, 7.7 课本: 7.1, 7.2, 7.7 什么是校验和,什么是 CRC? 什么是校验和,什么是 CRC? 对有效数据字符串 ”Hello!” ,应用 ” 校验和 ” 的方法,分别按照 4 位、 8 位进行校验计算, 给出二进制表示的 ” 校验和 ” ,并给出基本的 计算过程。 对有效数据字符串 ”Hello!” ,应用 ” 校验和 ” 的方法,分别按照 4 位、 8 位进行校验计算, 给出二进制表示的 ” 校验和 ” ,并给出基本的 计算过程。


Download ppt "Computer Networks and Internets 《计算机网络与因特网》课件 林坤辉 2004-02-6."

Similar presentations


Ads by Google