Sri Raghavendra Educational Institutions Society (R)
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Sri Krishna Institute of Technology
www.skit.org.in
Title:Transport Layer
CO addressed: CO4
Course: Computer Networks
Presented by: Nagaraja M
Department:Electronics & Communication Engg
/skit.org.in
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Sri Krishna Institute of Technology
Goals:
/skit.org.in
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Sri Krishna Institute of Technology
3.1 Introduction and Transport-Layer Services
A transport-layer protocol provides for logical communication between application processes running on different hosts.
As shown in Figure 3.1, transport-layer protocols are implemented in the end systems but not in network routers.
On the sending side, the transport layer converts the application-layer messages it receives from a sending application process into transport-layer packets, known as transport-layer segments.
Note that network routers act only on the network-layer
/skit.org.in
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Sri Krishna Institute of Technology
/skit.org.in
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Sri Krishna Institute of Technology
A Transport-layer protocol provides logical communication between processes running on different hosts, a Network-layer protocol provides logical communication between hosts.
Household Analogy:
12 kids in Ann’s house sending letters to 12 kids in Bill’s house:
Hosts =
Houses
Processes =
Kids/cousins
Application messages =
Letters in envelopes
Transport-layer protocol =
Ann and Bill who mux/demux to in-house siblings
Network-layer protocol =
Postal service
/skit.org.in
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Sri Krishna Institute of Technology
Internet transport-layer protocols
application
transport
network
data link
physical
/skit.org.in
(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)
Sri Krishna Institute of Technology
3.2 Multiplexing and Demultiplexing
At the destination host, the transport layer receives segments from the network layer just below. The transport layer has the responsibility of delivering the data in these segments to the appropriate application process running in the host.
The job of gathering data chunks at the source host from different sockets, encapsulating each data chunk with header information to create segments, and passing the segments to the network layer is called multiplexing.
At the receiving end, the transport layer examines these fields to identify the receiving socket and then delivers the segment to correct socket. This process is called demultiplexing.
Multiplexing/demultiplexing
3-8
10/3/2023
process
socket
use header info to deliver
received segments to correct
socket
demultiplexing at receiver:
handle data from multiple
sockets, add transport header (later used for demultiplexing)
multiplexing at sender:
transport
application
physical
link
network
P2
P1
transport
application
physical
link
network
P4
transport
application
physical
link
network
P3
9
10/3/2023
10
10/3/2023
How demultiplexing works
Figure 3.3 Source and destination port-number fields in a transport-layer segment
11
10/3/2023
12
10/3/2023
In this case, the application assigns a specific port number-namely 19157 to the UDP socket
13
10/3/2023
What is the purpose of the source port number?
14
10/3/2023
Connection-Oriented Multiplexing and Demultiplexing
15
10/3/2023
clientSocket = socket(AF_INET, SOCK_STREAM)
clientSocket.connect((serverName,12000))
16
10/3/2023
(1) the source port number in the segment,
(2) the IP address of the source host,
(3) the destination port number in the segment, and
(4) its own IP address.
This four values are illustrated in this diagram
17
10/3/2023
18
10/3/2023
3.3 Connectionless Transport: UDP
19
10/3/2023
20
10/3/2023
3.3.1 UDP Segment Structure
21
10/3/2023
1) Source port number field
2) Destination port number field
3) Checksum is used by the receiving host to check whether errors have been introduced into the segment.
4) The length field specifies the length of the UDP segment, including the header, in bytes
22
10/3/2023
3.3.2 UDP Checksum
Example, suppose that we have the following three 16-bit words:
23
10/3/2023
0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
-----------------------------------
1 0 1 1 1 0 1 1 1 0 1 1 0 1 0 1
1 0 1 1 1 0 1 1 1 0 1 1 0 1 0 1
1 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0
-----------------------------------
0 1 0 0 1 0 1 0 1 1 0 0 0 0 1 0
24
10/3/2023
25
10/3/2023
3.4 Principles of Reliable Data Transfer
26
10/3/2023
27
10/3/2023
28
10/3/2023
29
10/3/2023
30
10/3/2023
Reliable data transfer: getting started
send
side
receive
side
rdt_send(): called from above, (e.g., by app.). Passed data to
deliver to receiver upper layer
udt_send(): called by rdt,
to transfer packet over
unreliable channel to receiver
rdt_rcv(): called when packet arrives on rcv-side of channel
deliver_data(): called by rdt to deliver data to upper
31
10/3/2023
32
10/3/2023
3.4.1 Building a Reliable Data Transfer Protocol
33
10/3/2023
Figure 3.9 rdt1.0 – A protocol for a completely reliable channel
34
10/3/2023
Figure 3.9 rdt1.0 – A protocol for a completely reliable channel
35
10/3/2023
36
10/3/2023
In a computer network setting, reliable data transfer protocols based retransmission are known as ARQ (Automatic Repeat reQuest) protocols.
Three additional protocol capabilities are required in ARQ protocols to handle the presence of bit errors:
37
10/3/2023
38
10/3/2023
TCP: Overview RFCs: 793,1122,1323, 2018, 2581
39
10/3/2023
40
10/3/2023
3.5.2 TCP segment structure
41
10/3/2023
source port #
dest port #
32 bits
application
data
(variable length)
sequence number
acknowledgement number
receive window
Urg data pointer
checksum
F
S
R
P
A
U
head
len
not
used
options (variable length)
URG: urgent data
(generally not used)
ACK: ACK #
valid
PSH: push data now
(generally not used)
RST, SYN, FIN:
connection estab
(setup, teardown
commands)
# bytes
rcvr willing
to accept
counting
by bytes
of data
(not segments!)
Internet
checksum
(as in UDP)
42
10/3/2023
43
10/3/2023
The acknowledgment number that Host A puts in its segment is the sequence number of the next byte Host A is expecting from Host B.
44
10/3/2023
3.5.3 Round-Trip Time Estimation and Timeout
45
10/3/2023
What is the length of the timeout interval?
Soln:
The timeout should be larger than the connection’s round-trip time (RTT), that is, the time from when a segment is sent until it is acknowledged. Otherwise, unnecessary retransmissions would be sent.
0.125
46
10/3/2023
Fig: RTT samples and RTT estimates
47
10/3/2023
3.5.4 Reliable Data Transfer
48
10/3/2023
TCP sender events:
49
10/3/2023
data rcvd from app:
timeout:
ack rcvd:
TCP: retransmission scenarios
50
10/3/2023
lost ACK scenario
Host B
Host A
Seq=92, 8 bytes of data
ACK=100
Seq=92, 8 bytes of data
X
timeout
ACK=100
premature timeout
Host B
Host A
Seq=92, 8 bytes of data
ACK=100
Seq=92, 8
bytes of data
timeout
ACK=120
Seq=100, 20 bytes of data
ACK=120
SendBase=100
SendBase=120
SendBase=120
SendBase=92
TCP: retransmission scenarios
51
10/3/2023
X
cumulative ACK
Host B
Host A
Seq=92, 8 bytes of data
ACK=100
Seq=120, 15 bytes of data
timeout
Seq=100, 20 bytes of data
ACK=120
52
10/3/2023
Fig: Retransmission due to a lost acknowledgment
53
10/3/2023
Premature timeout
54
10/3/2023
A cumulative acknowledgment avoids retransmission of the
first segment
55
10/3/2023
Fast Retransmit
Doubling the Timeout Interval
Each time TCP retransmits, it sets the next timeout interval to twice the previous value, rather than deriving it from the last EstimatedRTT
Retransmitting the missing segment before that segment’s timer expires.
56
10/3/2023
57
10/3/2023
3.5.5 Flow Control
58
10/3/2023
LastByteRead
LastByteRcvd
LastByteRcvd – LastByteRead <= RcvBuffer
rwnd = RcvBuffer – [LastByteRcvd – LastByteRead]
59
10/3/2023
60
10/3/2023
3.5.6 TCP Connection Management
Let’s first take a look at how a TCP connection is established.
61
10/3/2023
62
10/3/2023
63
10/3/2023
Life cycle of a TCP connection
64
10/3/2023
65
10/3/2023
66
10/3/2023
Principles of TCP Congestion Control
The Causes and the Costs of Congestion
Scenario 1: Two Senders, a Router with Infinite Buffers
67
10/3/2023
68
10/3/2023
Scenario 2: Two Senders and a Router with Finite Buffers
69
10/3/2023
70
10/3/2023
Network-Assisted Congestion-Control Example:
ATM ABR Congestion Control
Asynchronous transfer mode (ATM) available bit-rate (ABR)
ATM ABR—a protocol that takes a network-assisted approach toward congestion control.
71
10/3/2023
72
10/3/2023
Slow Start