Title: Igor Radovanovic, i.radovanovic@tue.nl
1Computer Networks (2IC10)
- Communication Protocols
- Igor Radovanovic
- Thanks to
- P. van der Stok
- A. B. Forouzan
- A. Tanenbaum
2Packet transmission in ideal network
N. Olifer, V. Olifer
Computer Networks,
principles, technologies and protocols
for network design, Wiley Sons
- All packets delivered to the destination node
without loss or distortion - All packets delivered in the same order
- Delivery with minimum delay (d1d2d3)
3Communication problems
- corruption of packets
- loss of packets
- replication of packets
- ordering of packets
- independent failures of nodes
4Packet transmission in a real network
?1
2
3
4
5
6
1
t
1
2
3
4
6
d1
d4
t
d2
?1
d3
N. Olifer, V. Olifer
Computer Networks,
principles, technologies and protocols
for network design, Wiley Sons
- Packets are delivered with variable delays (d1?d2
?d3) - Packets are delivered out of order
- Packets may be lost or corrupted
- Average rate of information flow is different at
the input and at the output of the network
5Packet corruption
- Error detection
- Error correction
- Types of errors
- single bit only 1 bit in the data unit has
changed - burst error 2 or more bits in the data unit have
changed
Example 0.01 s of burst impulse noise
1200 bps data rate
12 bits of errors
6Error detection
- Redundancy adding extra bits for detecting
errors at the destination
7Error detection
- All methods use redundancy
8Parity check
even parity
- A parity bit is added to every data unit so that
the total number of 1s is even (or odd for odd
parity)
9Parity check-example-
- Suppose the sender wants to send the word world.
In ASCII, the five characters
are coded as - 1110111 1101111 1110010 1101100
1100100 - The following shows the actual bits sent
- 11101110 11011110 11100100 11011000
11001001 - Parity check can detect single-bit errors
- What about burst errors?
10Error detection
11CRC check
- based on binary division
- CRC added to the data unit so that the resulting
data becomes exactly divisible by a predetermined
number - CRC
- exactly 1 less bit than the divisor
- A string of n zeros added to the data unit
- New data divided by divisor
- Replace 0s by CRC
12CRC generator
13CRC generator (cntd)
Name Polynomial Application
CRC-8 x8 x2 x 1 ATM header
CRC-10 x10 x9 x5 x4 x 2 1 ATM AAL
ITU-16 x16 x12 x5 1 HDLC
ITU-32 x32 x26 x23 x22 x16 x12 x11 x10 x8 x7 x5 x4 x2 x 1 LANs
14CRC performance
- CRC can detect
- all burst errors that affect odd number of bits
- all burst errors of length ? degree of polynomial
- with high probability burst errors gt degree of
polynomial - Example
- CRC-12 (degree of 12)
- OK
- OK
- 99.97
15Error detection
16Checksum
Example IP header
- The data unit is divided into k sections, each of
n bits - All sections are added using 1s complement
- The sum is complemented
- The checksum is sent with data
171s complement
- Suppose the following block of 16 bits is to be
sent using a checksum of 8 bits. - 10101001 00111001
- The numbers are added using ones complement
- 10101001
- 00111001
------------ - Sum 11100010
- Checksum 00011101
- The pattern sent is 10101001 00111001
00011101
18Checksum (cntd)
- Performance
- Can we use this technique to detect an error if 2
corresponding opposite bits in 2 data segments
become corrupted? - An example
- Transmitted sequence 10101001 00111001
00011101 - Received sequence 00101001 10111001
00011101
19Error correction
- By retransmission
- flow and error control protocols
- Forward Error Correction (FEC)
- require more redundancy bits
- should locate the invalid bit or bits
- n-bit code word contains m data bits r
redundancy bits - nmr
- mr1 bits discoverable by r bits
- Example
- For m5 data bits can r be 3?
20Hamming code
- Example 7-bit ASCII code 4 bit redundancy
- Each r bit is the parity bit for one combination
of data bits - r1 bits 1, 3, 5, 7, 9, 11
- r2 bits 2, 3, 6, 7, 10, 11
- r3 bits 4, 5, 6, 7
- r4 bits 8, 9, 10, 11
20 1 1 1 1 1 1
21 2 2 2 2 2 2
22 4 4 4 4
23 8 8 8 8
? ? ? ? ? ? ? ? ? ? ?
1 2 3 4 5 6 7 8 9 10 11
21Hamming code (cntd)
- Example of redundancy bit calculation (even
parity)
22Hamming code (cntd)
- Error detection using Hamming code
once the bit is identified the receiver can
reverse its value
23Communication protocols
24Communication protocols-Wanted behavior-
- Communicating sender and receiver
- Order
- When sender has sent mi before mj and receiver
has accepted mj, then receiver has also accepted
mi - Validity
- When receiver has accepted mi then mi was sent by
sender - Progress
- A sent message is eventually accepted
25Stop-and-Wait Automatic Repeat reQuest
- simplest flow and error control mechanism
- the sending device keeps a copy of the last frame
transmitted until it receives an acknowledgement - identification of duplicate transmission (lost or
delayed ACK) - a damaged or lost frame is treated in the same
way - timers introduced
- positive ACK sent only for frames received safe
sound
26 A Simplex Stop-and-Wait ARQ
- normal operation
- the frame is lost
- the ACK is lost
- the ACK is delayed
27Stop-and-Wait ARQ -Normal operation-
- The sender will not send the next piece of data
until it is sure that the current one is
correctly received - sequence number necessary to check for duplicated
packets - No NACK when packet is corrupted duplicate
ACKs instead
28Stop-and-Wait ARQ -Lost or damaged frame-
roundtrip delay
processing in the receiver
Should be as short as possible. Why?
29Stop-and-Wait ARQ -Lost ACK-
Importance of numbering
30Stop-and-Wait ARQ -Delayed ACK-
Importance of ACK numbering
31Duplex Stop-and-Wait ARQ
- Piggybacking
- combine data with ACK (less overhead saves
bandwidth)
32Drawbacks of Stop-and-Wait ARQ
- after each frame sent the host must wait for an
ACK - inefficient use of bandwidth
- to improve efficiency ACK should be sent after
multiple frames - Alternatives Sliding Window protocols
- Go-back-N ARQ
- Selective Repeat ARQ
33Pipelining
- One task begins before the other one ends
- increases efficiency in transmission
34Sliding Window Protocols
- Sequence numbers
- sent frames are numbered sequentially
- number of frames stored in the header
- if the number of bits in the header is m than
sequence number goes from 0 to
2m-1 - Sliding window
- to hold the
- unacknowledged
- outstanding frames
- the receiver
- window size
- always 1
sequence number
frame
acknowledged frames
35Question
- What is the consequence of the window size in the
receiver on the order of the received packets? - Answer
- Window size 1 means that the packets are received
in order - Note this is not the case for the larger
receiver window size
36Go-back-N-Control variables-
- S- holds the sequence number of the recently sent
frame - SF holds sequence number of the first frame in
the window - SL holds the sequence number of the last frame
- R sequence number of the frame expected to be
received
37The name of Go-back-N why?
- Re-sending frame
- when the frame is damaged the sender goes back
and sends a set of frames starting from the last
one ACKnd - the number of retransmitted frames is N
- Example
- The window size is 4.
- A sender has sent frame 6 and the timer expires
for frame 3 (frame 3 not ACKnd). The sender goes
back and re-sends the frames 3, 4, 5 and 6.
38Go-back-N -normal operation-
- How many frames can be transmitted without
acknowledgment? - ACK1 not necessary if ACK2 is sent
- Cumulative ACK
expected sequence number
39Go-back-N -damaged or lost frame-
damaged frames are discarded! Why are correctly
received packets not buffered? What is the
disadvantage of this?
40Go-back-N -sender window size-
sequence number
41Go-back-N
- Inefficient
- all out of order received packets are discarded
- This is a problem in a noisy link
- many frames must be retransmitted -gt bandwidth
consuming - Solution
- re-send only the damaged frames
- Selective Repeat ARQ
- avoid unnecessary retransmissions
42Selective Repeat ARQ
- Processing at the receiver more complex
- The window size is reduced to 2m-1 (at most)
- Both the transmitter and the receiver have the
same window size - Receiver expects frames within the range of the
sequence numbers
43Selective Repeat ARQ-lost frame-
Note retransmission triggered with NACK and not
with expired timer
44Selective Repeat ARQ-sender window size-
45Communication problems
- corruption of packets
- loss of packets
- replication of packets
- ordering of packets
- independent failures of nodes
46Communication protocols
- We have assumed until now that packets cannot be
reordered - this when the parties are connected by a single
physical line - What if the channel is a network?
- the packets may arrive out of order
- Sequence number might be reused duplications
possible - How to solve this problem?
- Introduce the lifetime of the packet
47Connection establishment
- Connection request PDU
- Connection accepted PDU
- Is this enough?
- What if the network can store or duplicate
packets? - What if the subnet is so congested that ACK or
datagrams cannot go through? - Example bank transaction (delayed duplicates)
- Solutions
- new addresses for each connection?
- incremented sequence numbers?
- PACKET LIFETIME
48Packet lifetime
- Can be restricted using
- restricted subnet design
- prevents looping
- bounding congestion delay over the longest
possible path - putting a hop counter in each packet
- decrementing default value dropping when zero
- time stamping each packet
- carry the time when it was created
- discarded after some predefined time
- all the routers synchronized nontrivial
- Lifetime expires
- Not only the packets but all the ACKs must be
dead
49Connection Establishment (2)
dead time after crash (max packet lifetime)
data rate lt clk rate
- Time-of-day clock (not necessarily sync) 2 PDU
with the same seq. num. are never outstanding at
the same time - solves the delayed duplicate problem for data
PDU - (a) PDUs may not enter the forbidden region.
- (b) The resynchronization problem.
50Connection Establishment (2)
Three protocol scenarios for establishing a
connection using a three-way handshake. CR
denotes CONNECTION REQUEST. (a)
Normal operation, (b) Old CONNECTION REQUEST
appearing out of nowhere. (c) Duplicate
CONNECTION REQUEST and duplicate ACK.
51Connection Release
- asymmetric release
- a telephone line
- connection is broken when one party hangs up
- abrupt disconnection with loss of data.
- symmetric release
- each connection released separately
- continue to receive after disconnect PDU is sent
- avoid data loss
52Connection Release (2)
unreliable communication channel
53Connection Release (3)
disconnect request
6-14, a, b
- Four protocol scenarios for releasing a
connection. - (a) Normal case of a three-way handshake. (b)
final ACK lost.
54Connection Release (4)
6-14, c,d
- (c) Response lost. (d) Response lost and
subsequent DRs lost.