Download presentation
Presentation is loading. Please wait.
Published byMarjorie Wilkinson Modified over 9 years ago
1
Lecture 7: Reliable Packet Transmission
2
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) HeaderBody 816 8 CRC Beginning sequence Ending sequence
3
CRC strategy Sender and Receiver know the “divisor polynomial” –e.g. C(x)=x 3 +x 2 +1=1101 Send Message CRC with CRC chosen so that the whole thing is evenly divisible by C(x) Receiver calculates the remainder of Message CRC/C(x) There’s an error if it is not zero
4
CRC example Message=10011010 C=1101(3 rd order) Message CRC=10011010XYZ Choose XYZ so that remainder is zero for Message CRC/C
5
CRC Example cont. 11111001 1101 10011010 XYZ 1101 1001 1101 1000 1101 X=1 1011 Y=0 1101 Z=1 1100 1101 1xyz 1101 Message CRC=10011010 101
6
CRC Example cont. 11111001 1101 10011010000 1101 1001 1101 1000 1101 1011 1101 1100 1101 1000 1101 101 Message CRC=10011010 xor) 101
7
C(x) Examples CRC-8 x 8 +x 2 +x 1 +1=100000111 CRC-1011000110011 CRC-12110000000101 CRC-16 11000000000000101 CRC-CCITT10001000000100001 CRC-32 1000001001100000010001110110110111
8
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
9
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
10
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_short cksum(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); }
11
Reliable Transmission Problem: To detect packet loss To retransmit lost packets Delete duplicates. Assure proper order
12
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
13
Frame sequencing for Stop-and-Wait protocol
14
Time line for sliding window algorithm
15
Sliding Window Algorithm- sender LAR=last acknowledgement received LFS=last frame sent SWS=send window size LFS-LAR<SWS
16
Sliding Window Algorithm- receiver NFE=next frame expected LFA=last frame accepted RWS=receive window size LFA-NFE<RWS
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.