- 快召唤伙伴们来围观吧
- 微博 QQ QQ空间 贴吧
- 文档嵌入链接
- 复制
- 微信扫一扫分享
- 已成功复制到剪贴板
数据通信:错误、错误检测和控制错误
展开查看详情
1 .Chapter 6 Errors, Error Detection, and Error Control
2 .Introduction All transmitted signals will contain some rate of error (>0%) Popular error control methods include: Parity bits (add a 1 or 0 to the end of each seven bits) Longitudinal redundancy checking (LRC) Polynomial checking
3 .What’s an “error”? Human errors: Incorrect IP address assignment, or subnet mask, etc., etc. Network errors: Lost data Corrupted data (received, but garbled)
4 .Line Noise and Distortion Errors Likely cause Line outage White noise Impulse noise Cross-talk Attenuation Echo Jitter Delay distortion Source Storm, accident Movement of electrons Random spikes of power Guardbands, wires too close Wires too long Reflective feedback Timing irregularities Propagation speed
5 .Error Prevention To prevent errors from happening, several techniques may be applied: Proper shielding of cables to reduce interference Telephone line conditioning or equalization Replacing older media and equipment with new, possibly digital components Proper use of digital repeaters and analog amplifiers Observe the stated capacities of the media
6 .6
7 .Error Detection Methods The only way to do error detection and correction is to send extra data with each message Two common error detection methods: Parity checking Simple parity Longitudinal parity Cyclic redundancy checksum (CRC)
8 .Simple Parity Add an additional bit to each byte in the message: Even parity causes the sum of all bits (including the parity bit) to be even Odd parity causes the sum of all bits to be odd 0 1 0 1 0 1 0 1 Even parity 0 Odd parity
9 .Example D A T A Letter 1 0 0 0 1 0 0 1 0 0 0 0 0 1 1 0 1 0 1 0 0 1 0 0 0 0 0 1 7-bit ASCII 1 1 0 1 Parity bit 1 1
10 .Longitudinal Parity Add block check character (BCC) to the end of the message: Perform odd parity checking on the block of bits for each character in the message 0 1 0 1 0 1 0 0 1 0 0 1 1 1 0 1 0 0 1 1 0 1 1 1 BCC
11 .Example Letter Parity bit 1 0 0 0 1 0 0 1 0 0 0 0 0 1 1 0 1 0 1 0 0 1 0 0 0 0 0 1 7-bit ASCII 1 1 0 1 1 1 1 1 1 0 1 1 D A T A BCC 1 1 1 1
12 .Parity Checks Both simple parity and longitudinal parity do not catch all errors Simple parity only catches odd numbers of bit errors Longitudinal parity is better at catching errors But requires too many check bits added to a block of data We need a better error detection method What about cyclic redundancy checksum?
13 .Arithmetic Checksum Used in TCP and IP on the Internet Characters to be transmitted are converted to numeric form and summed Sum is placed in some form at the end of the transmission Receiver performs same conversion and summing and compares new sum with sent sum TCP and IP processes a little more complex but idea is the same
14 .Polynomial Checking Adds a character (or series of characters) to the end of the message based on a mathematical algorithm: Checksum Sum the message values and divide by 255. The remainder is the checksum D A T A 68 65 84 65 282 255 = 1 remainder 27 0 0 1 1 0 1 1 1 Checksum
15 .Cyclical redundancy check CRC error detection method treats packet of data to be transmitted as a large polynomial Transmitter Using polynomial arithmetic, divides polynomial by a given generating polynomial Quotient is discarded Remainder is “attached” to the end of message Message (with the remainder) is transmitted to the receiver Receiver divides the message polynomial plus the remainder (checksum) by same generating polynomial If a remainder of zero results Ú no error during transmission If a remainder not equal to zero results Ú error during transmission
16 .Example: CRC 0 0 1 1 0 1 1 1 0 1 2 3 4 5 6 7 Message polynomial x 5 +x 4 +x 2 +x 1 +x 0 x 5 +x 4 +x 2 +x+1 Generating polynomial ATM CRC x 8 + x 2 + x + 1 CRC-16 x 16 + x 15 + x 2 + 1
17 .17
18 .Error Control Once an error is detected, the receiver can: Toss the frame/packet Some newer systems such as frame relay perform this type of error control Return an error message to the transmitter Stop-and-wait error control Sliding window error control Fix the error with no further help from the transmitter
19 .Toss frame/packet Seems like a strange way to control errors but some lower-layer protocols such as frame relay perform this type of error control For example, if frame relay detects an error, it simply tosses the frame No message is returned Frame relay assumes a higher protocol (such as TCP/IP) will detect the tossed frame and ask for retransmission
20 .Return A Message Once an error is detected, an error message is returned to the transmitter Two basic forms: Stop-and-wait error control Sliding window error control
21 .Stop-and-wait Error Control A transmitter sends a frame then stops and waits for an acknowledgment If a positive acknowledgment (ACK) is received, the next frame is sent If a negative acknowledgment (NAK) is received, the same frame is transmitted again
22 .Sliding Window Error Control These techniques assume that multiple frames are in transmission at one time A sliding window protocol allows the transmitter to send a number of data packets at one time before receiving any acknowledgments Depends on window size When a receiver does acknowledge receipt, the returned ACK contains the number of the frame expected next Older sliding window protocols numbered each frame or packet that was transmitted More modern sliding window protocols number each byte within a frame
23 .Notice that an ACK is not always sent after each frame is received It is more efficient to wait for a few received frames before returning an ACK How long should you wait until you return an ACK? 23
24 .TCP/IP Rule 1: If a receiver just received data and wants to send its own data, piggyback an ACK along with that data Rule 2: If a receiver has no data to return and has just ACKed the last packet, receiver waits 500 ms for another packet If while waiting, another packet arrives, send the ACK immediately Rule 3: If a receiver has no data to return and has just ACKed the last packet, receiver waits 500 ms No packet, send ACK
25 .Packet Lost If a frame is lost, the following frame will be “out of sequence” The receiver will hold the out of sequence bytes in a buffer and request the sender to retransmit the missing frame
26 .ACK Lost If an ACK is lost, the sender will wait for the ACK to arrive and eventually time out When the time-out occurs, the sender will resend the last frame
27 .Correct the Error For a receiver to correct the error with no further help from the transmitter requires a large amount of redundant information to accompany the original data This redundant information allows the receiver to determine the error and make corrections This type of error control is often called forward error correction and involves codes called Hamming codes Hamming codes add additional check bits to a character These check bits perform parity checks on various bits
28 .For example, what if bit b9 flips? The c8 check bit checks bits b12, b11, b10, b9 and c8 (01000) This would cause a parity error The c4 check bit checks bits b12, b7, b6, b5 and c4 (00101) This would not cause a parity error (even number of 1s) The c2 check bit checks bits b11, b10, b7, b6, b3 and c2 (100111) This would not cause a parity error The c1 check bit checks b11, b9, b7, b5, b3 and c1 (100011) This would cause a parity error Writing the parity errors in sequence gives us 1001, which is binary for the value 9 Thus, the bit error occurred in the 9th position 28