Академический Документы
Профессиональный Документы
Культура Документы
Flow Control
Retransmission with Sliding Window
Page 2
Voice
Page 3
Page 4
Framing
To break the bit stream up into discrete
frames and compute the checksum for each frame. When a frame arrives at the destination, the checksum is recomputed and validated. One way to achieve this framing is to insert time gaps between frames. However, networks rarely make any guarantees about timing.
Page 5
Data Framing
Character count Starting and ending characters with
character stuffing Starting and ending flags with bit stuffing Physical layer coding violations
Page 6
Character Count
character count
5 1 2 3 4 5 6 7 8 9 8 0 1 2 3 4 5 6 8 7 8 9 0 1 2 3
frame 1 5 characters frame 2 5 characters one-bit error frame 3 8 characters frame 4 8 characters
5 1 2 3 4 7 6 7 8 9 8 0 1 2 3 4 5 6 8 7 8 9 0 1 2 3
frame 1 5 characters frame 2 (wrong) Now a character count
Even if the checksum is incorrect so the destination knows that the frame is bad, it still has no way of telling where the next frame starts.
Computer Networks Fall 2002 Page 7
user data
DLE ETX
end of frame
DLE(0x10): Data Link Escape STX(0x02): Start of TeXt ETX(0x03): End of TeXt
user data 0x10 DLE STX A DLE B DLE ETX DLE stuffed at the sender DLE STX A DLE DLE B DLE ETX DLE destuffed at the receiver DLE STX A DLE B DLE ETX
Computer Networks Fall 2002 Page 8
011011111111111111110010
Ending Delimiter V V 0 V V 0 0 0
beginning of frame
V: Violation bit
Computer Networks Fall 2002
end of frame
Page 10
Error Control
Three types of frames at a receivers end
Damaged frame : Negative acknowledgment / retransmission Lost frame : Time-out mechanism Valid frame : Sequence numbering / discarding for valid but duplicate frames
Page 11
Flow Control
A technique for assuring that a transmitting
Page 12
Error-detecting codes
Page 13
Codeword
n-bit codewords with
n =m+r and
general, only 2m codewords are legal. ASCII codes of 7 bits with 1 even parity bit
ASCII code for A: 1000001 codeword for A: 10000010 or 01000001 Codeword 10000011 or 11000001 is illegal.
Page 14
Hamming Distance
The number of bit positions in which two
codewords differ is called the Hamming distance between these two codewords. The Hamming distance of the complete code is the minimum Hamming distance between all pairs of legal codewords.
Page 15
Codeword Space
To detect
Page 17
Page 18
Code space : 2m n-bit legal messages(codewords) For an n-bit legal codeword, all its n neighbors at a distance 1 from it are illegal n+1 bit patterns are dedicated to each legal message (n+1)2m <= 2n and consequently (m+r+1)2m <= 2m+r. we have : (m+r+1) <= 2r
Page 19
Hamming Code
The bits that are powers of 2 (1, 2, 4, 8, 16,
etc.) are check or parity bits of some data bits. For example, m=7 (ASCII) and r=4 (7+4+1 <= 24) 1 001 000 H
B1 : B3 B5 B7 B9 B11 B2 : B3 B6 B7 B10 B11 B4 : B5 B6 B7 B8 : B9 B10 B11
codeword
Page 20
Page 21
arranged as a matrix, one codeword per row. To correct burst errors, the data should be transmitted one column at a time, i.e., column by column. If a burst error of length k bits occurs, at most 1 bit in each of the k consecutive codewords will have been affected, but the Hamming code can correct one error per codeword, so the entire block can be restored.
Computer Networks Fall 2002 Page 22
Page 23
Page 24
1 2 3 4 5 6 7 8 9 10 11 011 001 111 110 011 000 101 010 001 000 011
burst error
011 001 111 111 101 000 101 010 001 000 Codeword 00111010000 B1(011100)+B4(1101) => B5 10110001001 B1(110001)+B4(1000) => B5 B4(1101) => B4 11111010101
Computer Networks Fall 2002
Error Detection
Parity bit
Vertical redundancy check (VRC) Cyclic redundancy code (CRC code) / Polynomial code
Easy hardware implementation Can detect burst errors
Page 26
Parity Bit
block size: 1000 bits
Hamming code: 1000+10 bits (m+r+1 <= 2n) parity bit: 1000+1 bits
no error
Page 27
LRC
Page 28
example, 110001 represents a polynomial x5+x4+x0. Addition and subtraction are identical to EXCLUSIVE OR. For example,
10011011 + 11001010 = 01010001
Computer Networks Fall 2002
m-bit frame is regarded as the coefficient list for a polynomial, M(x), with m terms, ranging from xm-1 to x0. For
agree upon a generator polynomial, G(x), with the degree r in advance. Append r zero bits into M(x) => xrM(x) Divide xrM(x) by G(x) Subtract the remainder from xrM(x) and let the result be T(x)
Page 30
CRC Example
Page 31
+E(x)) /G(x) has zero reminder only if E(x) is divisible by G(x) Carefully selects G(x) such that E(x) is not divisible by G(x)
Page 32
E(x)= xj
If G(x) contains tow or more terms, it will never divided E(x) E(x)= xi +xj = xj ( xi-j+ 1)
Assume
Select G(x) that does not divide xk+1, where 1< k i-j
Page 33
.. i>j
Page 34
Page 35
receiver provide feedback to the sender The sender sends one frame and then waits for an acknowledgement before proceeding
Page 37
receiver would only send an ack if the data were correctly received After time out, the sender send the frame again
Page 38
The senders timer eventually time-out The sender resends the same data frame After the data frame is received, the receiver sends acknowledgement again
Page 39
Page 40
Page 41
Page 42
Page 43
Piggybacking
Page 44
Acknowledgement
Techniques
The technique of temporarily delaying outgoing acknowledgements so that they can be hooked onto the next outgoing data frame is known as piggybacking.
Types Positive Acknowledgement: The received frame has no error. Negative Acknowledgement: The received frame has errors.
Computer Networks Fall 2002 Page 45
Flow Control
Flow control is a technique for assuring that
a transmitting station does not overwhelm a receiving station with data. Sliding Window Protocols: At any instant of time, the sender maintains a set of sequence numbers corresponding to frames it is permitted to send. These frames are said to fall within the sending window. Similarly, the receiver also maintain a receiving window corresponding to the set of frames it is permitted to accept.
Computer Networks Fall 2002
Page 46
Sliding Windows
Each outbound frame contain a sequence
Maintained by the sender A set of sequence numbers corresponding to frames the sender is permitted to send
Receiving window Maintained by the receiver Corresponds the set of frames the receiver is permitted to accept
Computer Networks Fall 2002 Page 47
a frame is sent, the upper edge of the window is advanced by one When an acknowledgement is received, the lower edge of the window is advanced by one
Receiving window Any received frame the sequence number outside the window is discarded When a frame whose sequence number is equal to lower edge of the window is received, the window is rotated by one
Computer Networks Fall 2002 Page 48
Page 49
Page 50
A protocol in which the sender sends one frame and then waits for an acknowledgement before proceeding.
window size = 1
Seq : the sequence number of this frame Ack : the number of the last frame is received
Efficiency of Stop-and-Wait
Stop-and-Wait
50 kbps data rate 500 msec round-trip delay 1000 bits per frame
time (msec) t=0 start sending t=20 completely sent t=250 frame arrival t=270 completely received t=270 acknowledge without delay t=520 acknowledgement arrival
26000 bits could be transmitted in 520 msec. Efficiency: 1000/26000=20/520 < 4% used
Computer Networks Fall 2002 Page 52
Efficiency of Stop-and-Wait
Page 53
Pipelining
50 kbps data rate 500 msec round-trip delay 1000 bits per frame time (msec) t=0 start sending the first frame t=20 the first completely sent t=250 frame arrival t=270 the first completely received t=270 acknowledge without delay t=520 acknowledgement arrival
To pipeline frames without waiting for acknowledgements.
Computer Networks Fall 2002 Page 54
Pipelining
Page 55
Page 56
Go-back-N
Senders window size is n (n >1)
At
After receiving a damaged frame Receiver discards all subsequent frames Sender retransmits the damaged frame and all its successors after the times out
Page 57
Go-back-N : An Example
Page 58
Selective Repeat
Receivers window size is n ( n >1 )
At
following the bad one The sender retransmits only the bad frame not all its successors
Page 59
Page 60
protocols. Both Go-back-N and Selective-repeat ARQs uses the pipelining technique.
Computer Networks Fall 2002 Page 61
ARQ
Instead of using positive or negative
acknowledgement, the receiver sends back only the frame number of the next frame is expects On the receipt of each frame (including damaged)
It may speed up the transmission of lost or damaged frames, if the time-out value is loose
Page 62
Page 63
Window Size
The optimal senders windows size is
1+(round-trip delay / transmission time) Maximum window size of Go-back-N ARQ is MaxSeq, where the sequence number are 0, 1, ... , MaxSeq.
Maximum window size of Selective-repeat
ARQ is (MaxSeq+1)/2.
Page 64
Page 65
that the protocol machine is waiting for the next event to happen
Transitions
Occur when some event occurs Change form some state to another
Page 66
bit destuffed
0/11111
Page 68
SLIP
Page 69
Control) of IBMs SNA ADCCP (Advanced Data Communication Control Procedure): ANSI HDLC: ISO LAP (Link Access Procedure): X.25 of CCITT LAPB: CCITT http://members.tripod.com/~vkalra/hdlc.ht ml
Computer Networks Fall 2002 Page 70
01111110. On idle point-to-point lines, flag sequences are transmitted continuously. Address
to identify one of multiple terminals for point-tomultipoint lines to distinguish commands from responses for point-to-point lines
Page 71
Address A
address=0xC0, response
address=0x80, command
Address B address=0x80, response
Page 72
Unnumbered
Page 74
N(R): the next frame expected to be received REJ (Reject): negative acknowledgement frame N(R): the first frame in sequence not received correctly (Go-back-N protocol) RNR (Receive not Ready): same as Type 0 and telling the sender to stop sending SR (Selective Reject): acknowledgement frame N(R): the frame expected to be retransmitted (Selective Repeat protocol)
Page 75
UA SABM DISC DM
Serial Line IP
SLIP (Serial Line IP): to connect SUN
workstations to the Internet over a dial-up line using a modem in 1984 RFC 1055 Sending IP packets over the line, with a special flag byte at the end for framing. Using character stuffing. Many problems: no error detection, supporting only IP, no authentication, etc.
Computer Networks Fall 2002 Page 77
Point-to-Point Protocol
PPP: RFC 1661, RFC 1662, RFC 1663 A multiprotocol framing mechanism suitable
for use over modems, HDLC lines, SONET , and other physical layers. Supports error detection, option negotiation, header compression, and optionally, reliable transmission using HDLC framing. Character-oriented
Computer Networks Fall 2002
Page 78
Homework
#2, #3, #6, #9,#11
Page 79