Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC...
-
Upload
marjorie-wilkinson -
Category
Documents
-
view
215 -
download
1
Transcript of Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC...
![Page 1: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/1.jpg)
Lecture 7: Reliable Packet Transmission
![Page 2: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/2.jpg)
Cyclic Redundancy Check
• Add k bits of extra data (the CRC field) to an n-bit message to provide error detection function
– For efficiency, want k << n
– e.g., k = 32 for Ethernet and n = 12,000 (1500 bytes)
Header Body
8 16 16 8
CRCBeginningsequence
Endingsequence
![Page 3: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/3.jpg)
CRC strategy
• Sender and Receiver know the “divisor polynomial”– e.g. C(x)=x3+x2+1=1101
• Send MessageCRC with CRC chosen so that the whole thing is evenly divisible by C(x)
• Receiver calculates the remainder of
MessageCRC/C(x) There’s an error if it is not zero
![Page 4: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/4.jpg)
CRC example
• Message=10011010 C=1101(3 rd order)
• MessageCRC=10011010XYZ
• Choose XYZ so that remainder is zero for MessageCRC/C
![Page 5: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/5.jpg)
CRC Example cont.
• 11111001 110110011010XYZ
1101 1001 1101
1000 1101
X=1 1011 Y=0 1101 Z=1 1100
1101 1xyz1101
• MessageCRC=10011010 101
![Page 6: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/6.jpg)
CRC Example cont.• 11111001
110110011010000 1101 1001 1101 1000
1101 1011 1101 1100
1101 1000 1101 101
• MessageCRC=10011010xor) 101
![Page 7: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/7.jpg)
C(x) Examples• CRC-8 x8+x2+x1+1=100000111• CRC-10 11000110011• CRC-12 110000000101• CRC-16 11000000000000101• CRC-CCITT 10001000000100001• CRC-32
1000001001100000010001110110110111
![Page 8: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/8.jpg)
1’s complement addition
• 0=0000 -0=1111
• 1=0001 -1=1110
• 2=0010 -2=1101
• 2+3=0010+0011=0101=5
• 2+(-0)=0010+1111+0001=0010=2
• 3+(-2)=0011+1101+0001=0001
![Page 9: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/9.jpg)
Internet Checksum Strategy
• 0 1010 0001 1001 1100 =0000A19C
• 0 0110 1010 1111 0010 =00006AF2
• 1 0000 1010 1000 1110 =00010A8E
• =>00000A8E
• =>0000 1010 1000 1111=00000A8F
• =>0A8F
• =>F670
![Page 10: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/10.jpg)
Internet Checksum Algorithm• View message as a sequence of 16-bit integers;
sum using 16-bit ones-complement arithmetic; take ones-complement of the result.
u_shortcksum(u_short *buf, int count){ register u_long sum = 0; while (count--) { sum += *buf++; if (sum & 0xFFFF0000) { /* carry occurred, so wrap around */ sum &= 0xFFFF; sum++; } } return ~(sum & 0xFFFF);}
![Page 11: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/11.jpg)
Reliable Transmission
• Problem:
• To detect packet loss
• To retransmit lost packets
• Delete duplicates.
• Assure proper order
![Page 12: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/12.jpg)
Stop and Wait
Sequence numbers: 0,1,0,1 etc.
Resend if no Ack before timeout
+ guarantees arrival of all frames in order
-lots of downtime, particularly for long RTTs
![Page 13: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/13.jpg)
Frame sequencing for Stop-and-Wait protocol
![Page 14: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/14.jpg)
Time line for sliding window algorithm
![Page 15: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/15.jpg)
Sliding Window Algorithm-sender
• LAR=last acknowledgement received• LFS=last frame sent• SWS=send window size• LFS-LAR<SWS
![Page 16: Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.](https://reader036.fdocuments.us/reader036/viewer/2022082711/56649ed15503460f94be085a/html5/thumbnails/16.jpg)
Sliding Window Algorithm-receiver
• NFE=next frame expected• LFA=last frame accepted• RWS=receive window size• LFA-NFE<RWS