









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Packets, Frames, and Error Detection Summary Packets are a convenient way to group data Packets facilitate fair use of a network Packets facilitate error control and correction Packets are delimited by specific characters, so use character stuffing to send these as text. Basically, packets should be viewed as envelopes with standard mail inside. The contents are just delivered; other programs interpret the contents of the package.
The physical layer of a network transmits individual bits across the network. This is usually either copper wire or glass fiber. We now consider how the bits of data are organized into packets that are recognized by both sender and receiver. Packets are “small blocks” of data, sent as a unit. As a guess, most packets are probably smaller than a few thousand bytes. Remember that both the term “byte” and the term “octet” refer to eight bits of data; the latter term is the preferred Internet terminology. The sender gains exclusive use of the network for the duration of time to send one packet and then must wait to send the next packet in the data stream< if there is one. This allows fairer sharing of the network resources.
In a simple TDM (Time Division Multiplexing) arrangement, the control inputs are sequenced through all possible values. The above example would sequence 0, 1, 2, 3, 0, 1, 2, 3, etc. Each input is sampled for a fixed “time slice”. As an example, TDM allows more than one telephone conversation to be placed on the same telephone line. The standard is that each conversation must be sampled 8,000 times per second; this as a consequence of the Nyquist Sampling Theorem. This is one sample every 125 microseconds. If each sample requires 2 microseconds, we could have as many as 60 conversations on a single wire. Each sender must be sampled at a fixed rate and the sample delivered, at this same fixed rate, to the proper receiver.
Imagine a 5 MB file transmitted as a single unit. At 56 Kb/s (7,000 bytes per second), this requires almost 12 minutes. A single bit error, if detected, will force retransmission of everything. Imagine a 5 MB file transmitted as 5,000 packets, each of 1 KB. At 56 Kb/sec, this requires about 143 milliseconds for each packet. A single bit error, if detected, will force retransmission of only one packet. On a lightly loaded network, transmission of the file might not take significantly more than 12 minutes. IP (Internet Protocol) As we shall see, the use of packets facilitates both the IP and protocols built on top of the IP.
If your message is purely readable text, the above framing scheme works well. Suppose your message has another encoding scheme and includes characters with ASCII codes 1 and 4. Receipt of the Control–D will cause the receiver to terminate the frame. This is not good. The solution is to use character stuffing , with the escape character, which is denoted as esc with ASCII code 0x1B or 27 (decimal). A soh character in the data is replaced by the sequence esc x, or 1B 78. An eot character in the data is replaced by the sequence esc y, or 1B 79. But what about an esc character in the data, especially one followed by an x. The esc character itself is converted to esc z, or 1B 7A, so that the two byte data sequence “ esc d” would convert to “ esc z d” and transmitted as 1B 7A 64.
While some encoding schemes allow for correction of single–bit errors, most protocols will request retransmission of packets received with errors. Parity is used for simple transmissions. An 8–bit character might contain a 7–bit ASCII code along with a single parity bit. The parity bit is set as follows even parity the number of 1’s in the 8–bit code is an even number, including 0. odd parity the number of 1’s in the 8–bit code is an odd number: 1, 3, 5 or 7. Check sums are more robust methods for error detection. These append a computed number (usually 16 or 32 bit) to the frame. The receiver computes this number from the packet data and compares it to the received value. If the two match, we assume no error. The CRC (Cyclic Redundancy Check) is a very common form of error detector.
The CRC treats any message M as a sequence of bits. Denote the number of bits in a message by m. For IP messages, this may be a large number, say m 12,000. Append to this message M of length m a check sum R of length r. The full frame thus has a length of ( m + r ) bits. For IP version 4, r = 32. Any of the standard CRC algorithms can detect burst errors in transmission that do not exceed r bits. For IP version 4, r = 32, so the CRC can detect burst errors (strings of bad bits) of length less than 33. The CRC is generated by an ( r + 1)–bit pattern , called the generator. This is denoted by G. For IP version 4, this has 33 bits. The CRC theory is based on the study of polynomials of order r over GF(2), the field of binary numbers. For this reason, many discussions focus on G as a polynomial, though it can be represented as a binary string. For our example, G is the polynomial X 3
(NOTE: The earlier versions of the notes, dated 6/22/2006, had an error. In this example the message was changed to 101110, six bits.) In simple terms, the CRC for the message is the remainder from division of the binary number M 2 r by the binary number G. In binary, a number is multiplied by 2 r by appending r zero bits. Example: M = 10111 G = 1001 so r = 3, as G has (r + 1) bits. M 2 r = 10111 000, the message with 3 zeroes appended. Converted to decimal, M = 23 and M 2 r = 184. The generator G is required to have the leftmost (most significant) bit set to 1. Here it is the leading 1, the coefficient of X 3 . Begin division, remembering to use the XOR function in stead of subtraction.
We next “bring down” the 0 and continue. _____ 101 __ 1001 ) 10111000 1001 1010 1001 11 Note again, that this is an XOR operation, not binary subtraction. The result of binary subtraction would be 1, not 11.
We complete the “division”, discard the quotient and keep the remainder. _____ 10101 1001 ) 10111000 1001 1010 1001 1100 1001 101 Here R = 101. Note that the remainder must be represented as a 3–bit number, so that were it equal to 11, it would be shown as 011.