Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 1Chapter 3.6: Layer 4
Layer 4 - Transport Layer
Core of the protocol hierarchy:
• Network-independent, reliable and economical data transfer
Tasks of the transport layer:
• Connection-oriented or connectionless data transfer
• Addressing of a certain communication process on a computer
• Error handling, error detection, error correction
• Flow control
• Multiplexing
1. Upward - several transport connections to one network connection
2. Downward - one transport connection to several network connections (e.g. if not sufficient capacity of a network connection is given)
• Quality guarantees
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 2Chapter 3.6: Layer 4
For what do we need a Transport Layer for?
Is layer 4 redundant?
No, because:
• The network layer belongs to the network carrier:
A user does not have any control over network details and problems
• Hiding of technical details from higher layers
• Addressing of a destination process
• End-to-end view of a data flow
• Generally: Improvement of the quality of the data communication on layer 3
Similarity to layer 3:
• Connection-oriented and connectionless data transmission
• Addressing
• Flow control
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 3Chapter 3.6: Layer 4
Simple Transport Protocol
TPDU: Transport Protocol Data Unit
Nesting of the PDUs:
Frame header
Packet header
TPDU header
TPDU payload
Packet payloadFrame payload
FCS
DISCONNECT
RECEIVE
SEND
CONNECT
LISTEN
Operation
DISCONNECTION REQ. (DR)
--
DATA
CONNECTION REQ. (CR)
--
Sent TPDU
Attempt of a connection termination
Block until a Data TPDU arrives
Data transmission
Attempt of a connection establishment
Block until a process tries to establish a connection
Meaning
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 4Chapter 3.6: Layer 4
Simple transport protocol
Sender (Client)Receiver (Server)
LISTENCONNECT
RECEIVESEND
DISCONNECT
DISCONNECT
CONNECT
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 5Chapter 3.6: Layer 4
Sounds easy…
… is however nevertheless quite complicated: the network can lose packets, store packets, duplicate packets.
Solution:
• Sequence numbers• Three-Way Handshake
A connection establishment consists of three parts:
� The Connection Request,
� The confirmation of the receiver that the connection establishment is accepted,
� The confirmation of the sender that the confirmation of the receiver was received and the sending request is still given.
A compromise between reliability and complexity is to be obtained by this principle.
REJECT (ACK=y)
ACK (seq=y, ACK=x)
ACK (seq=x+1, ACK=y)
Host 1 Host 2
CR (seq=x)
Host 1 Host 2
CR (seq=x)
ACK (seq=y, ACK=x)
Duplicate
Connection Establishment
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 6Chapter 3.6: Layer 4
The flow control is similar to the one on layer 2, only considering the whole network:
• Larger number of connections
• Buffering of TPDUs
• Apart from losses, also permutations of packets are possible
⇒ Dynamic buffer management (request for buffer at the communication partner)
Principle: Sliding Window with variable window size:Adaptation of buffer size considering receiver and network
Flow Control and Buffer Assignment
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 7Chapter 3.6: Layer 4
A waits for buffer space
B waits that A sends dataDanger of deadlock; send Control TPDUs in regular time intervals
Dynamic Buffer Assignment
B informs A about 4 buffer places←<ack = 6, buf = 4>16
A sends TPDU 6; A is blocked (no more buffer)→<seq = 6, data = m6>→14
B acknowledges TPDU 5 and 6, but sender remains blocked←<ack = 6, buf = 0>←15
B informs A about 1 buffer place←<ack = 4, buf = 1>←11
B acknowledges TPDU 2, 3, 4 - sender is stopped (no buffer)←<ack = 4, buf = 0>←10
B informs A about 2 buffer places←<ack = 4, buf = 2>←12
A sends TPDU 5→<seq = 5, data = m5>→13
A sends TPDU 0→<seq = 0, data = m0>→3
A sends TPDU 1→<seq = 1, data = m1>→4
A sends TPDU 2, TPDU is lost<seq = 2, data = m2>→5
B acknowledges TPDU 0 and 1, buffer places are reduced to 3←<ack = 1, buf = 3>←6
A sends TPDU 3→<seq = 3, data = m3>→7
A sends TPDU 4→<seq = 4, data = m4>→8
A repeats to send TPDU 2→<seq = 2, data = m2>→9
B grants 4 buffer places for A and waits for TPDU 0←<ack = 15, buf = 4>←2
A asks for 8 places in B’s buffer→<request 8 buffers>→1
BMessageAack/seq ∈{0, …, 15}
Timeout for TPDU 2 }
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 8Chapter 3.6: Layer 4
2 variants:
• asymmetrically, as with the telephone: abrupt break
• symmetrically, i.e. each participant terminates his direction
• The symmetrical variant is more complex, again TPDUs can be lost ⇒ timer Host 1 Host 2
DR
DR
ACK
send DR and start
timer
send DR and start
timer
terminate connection
terminate connection
send confirmation
Host 1 Host 2
DR
DR
ACK
send DR and start
timer
send DR and start
timer
Timeout
terminate connection
terminate connection
ACK
DR
DR
send DR and start
timer
send DR and start
timer
terminate connection
terminate connection
Timeout
send DR and start
timerDR
send DR and start
timerDR
DR
DR
send DR and start
timer
send DR and start
timer
Timeout
terminate connection
N Timeouts
terminate connection
Timeout
send DR and start
timer
DR
::
DR
DR
Connection Termination
send confirmation
send confirmation
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 9Chapter 3.6: Layer 4
Implementation Example
Simple transport protocol, which covers the following TPDU types:
Control data for the management of the window sizeCREDIT
Data transmissionDATA
Answer to CLEAR REQUESTCLEAR CONFIRMATION
Attempt of a connection terminationCLEAR REQUEST
Answer to CALL REQUESTCALL ACCEPTED
Attempt of a connection establishmentCALL REQUEST
MeaningTPDU
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 10Chapter 3.6: Layer 4
Implementation Example
A connection can have one of the following states:
• Idle – no connection is established.
• Waiting – a CONNECT took place, CALL REQUEST is sent.
• Queued – the CALL REQUEST was received but not yet processed.
• Established – connection establishment finished.
• Sending – wait for transmission permission.
• Receiving – the receiver executed a RECEIVE.
• Disconnecting – local call of DISCONNECT.
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 11Chapter 3.6: Layer 4
Implementation Example
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 12Chapter 3.6: Layer 4
Implementation Example
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 13Chapter 3.6: Layer 4
Implementation example
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 14Chapter 3.6: Layer 4
Implementation Example
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 15Chapter 3.6: Layer 4
Implementation Example
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 16Chapter 3.6: Layer 4
Implementation Example
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 17Chapter 3.6: Layer 4
Implementation Example
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 18Chapter 3.6: Layer 4
Implementation Example
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Page 19Chapter 3.6: Layer 4
Representation of the protocol as finite state machine
Top Related