Title: Peter.van.der.stok@philips.com
1Communication protocols
Thanks to A. Tanenbaum
2Communication problems
- loss of packet
- replication of packets
- corruption of packets
- ordering of packets
- independent failures of nodes
3Packet corruption
- error correction
- error detection (transform to packet loss)
4Error correcting code(1)
n bit Code word contains m data bits r
redundancy bits (n mr)
Hamming distance number of bits in which code
words differ Hamming distance of d requires d
single bit errors to convert one code word into
another. Example hamming distance of 5 and 4
valid code words 0000000000 1111100000
0000011111 1111111111
5Error correcting code(2)
Correction of single bit error n bit code word
with m data bits and r check bits each of the 2m
legal words requires n1 bit patterns 2n words
implies (n1) 2m lt 2n n mr gt (mr1) lt 2r
6Error correcting code(3)
Hamming code Check bits are powers of 2
1,2,4,8,16,.. Data bits are 3,5,6,7,9,10,11,12,13
,14,15,17, check bits that contribute to bit
k k sum 2i , e.g 9 18, 13 148 for
bit 9 .
7Error correcting code(4)
1 1 1 2 3 4 5 6 7 8 9
0 1 a b 1 c 0 0 1 d 0 0 0 (3) ab 1 (5) ac
0 (6) cb 0 (7) abc 1 (9) ad 0 (10) db
0 (11) dab 0
a (3,5,7,9,11) (1,0,1,0,0) 0 b
(3,6,7,10,11) (1,0,1,0,0) 0 c
(5,6,7) (0,0,1) 1 d (9,10,11)
(0,0,0) 0 0 0 1 1 0 0 1 0 0 0 0 or 1 0 0 1 0 0
0 0 0 1 0
8Error detecting code(1)
Add parity bit at end of bit sequence to detect
single bit error better detection of multiple
error bits polynomial code or Cyclic Redundancy
Check (CRC) Sender and receiver agree on
generator polynomial G(x) r-1 is degree of G(x)
(contains r bits) M(x) is data (contains m
bits) Send T(x) xr M(x) div such that T(x)
k G(x)
9Error detecting code(2)
Example G(x) x2 1 M(x) 1 1 0 0 1 x3
M(x) 1 1 0 0 1 0 0 0 101 1 1 0 0 1 0 0 0
1 0 1 1 1 0 1 0 1
1 1 1 1 0 1
1 0 0 1 0 1
1 0 0 1 0 1
1 transmit 1 1 0
0 1 0 0 1
10Error detecting code(3)
Choice of G(x) inclusion of x1 detects all odd
number of bit changes degree r-1 implies all
bursts lt r are detected IEEE 802 x to the power
of 32,26,23,22,16,12,11,10,8,7,5,4,2,1,0
11Wanted 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
12Wanted behavior
Protocols - No overflow at destination -
Re-send lost messages - prevent network
congestion (overflow in transferring nodes)
13Request-Reply failure ambiguity
No work
No work
No work
Work done
Work done
Work done
14Request-Reply semantics
- Exactly once semantics
- At-least once semantics
- At most once semantics
15At most once semantics
- No failures, then reply returned and work is
done - Within failure spec, reply is returned and work
is done - All other cases, work is done once, partially or
not at all - and client receives failure warning
16Alternating Bit Protocol
- Two scenarios (a) Normal case. (b)
Abnormal case. - The notation is (seq, ack, packet number).
- An asterisk indicates where a network layer
accepts a packet.
17Sliding Window Protocols
- A sliding window of size 1, with a 3-bit sequence
number. - (a) Initially.
- (b) After the first frame has been sent.
- (c) After the first frame has been received.
- (d) After the first acknowledgement has been
received.
18A Protocol Using Go Back N
- Pipelining and error recovery. Effect on an
error when - (a) Receivers window size is 1. (b) Receivers
window size is large.
19Sliding Window Protocol Using Go Back N
- Simulation of multiple timers in software.
20A Sliding Window Protocol Using Selective Repeat
- (a) Initial situation with a window size seven.
- (b) After seven frames sent and received, but not
acknowledged. - (c) Initial situation with a window size of four.
- (d) After four frames sent and received, but not
acknowledged.
21Connection Establishment
- How a user process in host 1 establishes a
connection with a time-of-day server in host 2.
22Connection Establishment (2)
- (a) TPDUs may not enter the forbidden region.
- (b) The resynchronization problem.
23Connection Establishment (3)
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.
24Connection Release
- Abrupt disconnection with loss of data.
25Connection Release (2)
26Connection Release (3)
6-14, a, b
- Four protocol scenarios for releasing a
connection. - (a) Normal case of a three-way handshake. (b)
final ACK lost.
27Connection Release (4)
6-14, c,d
- (c) Response lost. (d) Response lost and
subsequent DRs lost.
28Client with short server
Request,S,N
sS,nN,r0
sS,nN,r0
Request,S,N
sS,nN,r1
sS,nN1,r0
Reply,S,N
sS,nN,r2
Request,S,N
Reply,S,N
sS,nN1,r0
Request,S,N1
sS,nN2,r0
Reply,S,N1
sS,nN2,r0
29Client with long server
Request,S,N
sS,nN,r0
sS,nN,r0
Request,S,N
sS,nN,r1
sS,nN,r0
Ack,S,N
sS,nN,r0
Alive,S,N
Ack,S,N
Reply,S,N
Ack,S,N
sS,nN1,r0
sS,nN1,r0
30Client-server termination?
sS,nN,r0
sS,nN,r0
Reply,S,N
Ack,S,N
sS,nN1,r0
sS,nN,r1
Reply,S,N
sS,nN,r2
Reply,S,N
sS,nN,rRM
Reply,S,N
sS,nN1,r0
31Client with long/short server
sS,nN,r0
Request,S,N
sS,nN,r0
Request,S,N
sS,nN,r1
sS,nN1,r0
Reply,S,N
sS,nN1,r0
Request,S,N1
Request,S,N1
sS,nN1,r1
Ack,S,N1
sS,nN1,r0
Alive,S,N1
Ack,S,N1
sS,nN2,r0
Reply,S,N1
sS,nN2,r0
Ack,S,N1
32Symmetric client-server
Request,S,N
sS,nN,r0
sS,nN,r0
Request,S,N
sS,nN,r1
Ack,S,N
Alive,S,N
sS,nN,r0
Ack,S,N
Reply,S,N
sS,nN1,r0
Reply,S,N
Ack,S,N
sS,nN1,r0
Alive,S,N1
Ack,S,N1
33Symmetric client-server
Request,S,N
sS,nN,r0
sS,nN,r0
Request,S,N
sS,nN,r1
Ack,S,N
Alive,S,N
sS,nN,r0
Ack,S,N
Reply,S,N
Request,S,N1
sS,nN1,r0
sS,nN1,r0