0% found this document useful (0 votes)
30 views

Week8 - Lecture2 Chapter - 3

The document discusses the transport layer in computer networks. It provides an overview of transport layer services like multiplexing and demultiplexing. It also describes the two main Internet transport protocols, TCP which provides reliable connection-oriented transport, and UDP which provides unreliable connectionless transport.

Uploaded by

smarham334
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Week8 - Lecture2 Chapter - 3

The document discusses the transport layer in computer networks. It provides an overview of transport layer services like multiplexing and demultiplexing. It also describes the two main Internet transport protocols, TCP which provides reliable connection-oriented transport, and UDP which provides unreliable connectionless transport.

Uploaded by

smarham334
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 37

Computer Networks

Week8_Lecture2 (Chapter3)
Transport Layer

Subhan Ullah, PhD


[email protected]

BS(Computer Science) Spring-2024


Transport Layer: 3-1
Transport layer: overview
Our goal:
 understand principles  learn about Internet transport
behind transport layer layer protocols:
services: • UDP: connectionless transport
• multiplexing, • TCP: connection-oriented reliable
demultiplexing transport
• reliable data transfer • TCP congestion control
• flow control
• congestion control

Transport Layer: 3-2


Transport layer: roadmap
 Transport-layer services
 Multiplexing and demultiplexing
 Connectionless transport: UDP
 Principles of reliable data transfer
 Connection-oriented transport: TCP
 Principles of congestion control
 TCP congestion control
 Evolution of transport-layer
functionality
Transport Layer: 3-3
Transport services and protocols
application
transport

 provide logical communication mobile


network
network
data link
physical

between application processes national or global ISP

running on different hosts

log
ica
le
 transport protocols actions in end

n d-
systems:

e nd
local or

tra
• sender: breaks application messages regional ISP

nsp
into segments, passes to network layer

ort
home network content
• receiver: reassembles segments into provider
network
messages, passes to application layer application
transport
datacenter
network
network

 two transport protocols available to data link


physical

Internet applications enterprise


network
• TCP, UDP
Transport Layer: 3-4
Transport vs. network layer services and protocols
household analogy:
12 kids in Ann’s house sending
letters to 12 kids in Bill’s house:
 hosts = houses
 processes = kids
 app messages = letters in
envelopes
 transport protocol = Ann and Bill
who demux to in-house siblings
 network-layer protocol = postal
service
Transport Layer: 3-5
Transport vs. network layer services and protocols

 network layer: logical household analogy:


communication between 12 kids in Ann’s house sending
hosts letters to 12 kids in Bill’s house:
 hosts = houses
 transport layer: logical
 processes = kids
communication between
 app messages = letters in
processes envelopes
• relies on, enhances, network  transport protocol = Ann and Bill
layer services who demux to in-house siblings
 network-layer protocol = postal
service
Transport Layer: 3-6
Transport Layer Actions

Sender:
application  is passed an application- app. msg
application
layer message
transport
 determines segment TTh htransport
app. msg
header fields values
network (IP)
 creates segment network (IP)

link
 passes segment to IP link

physical physical

Transport Layer: 3-7


Transport Layer Actions

Receiver:
application  receives segment from IP application
 checks header values
app. msg
transport  extracts application-layer transport
message
network (IP)  demultiplexes message up network (IP)

link to application via socket link

physical physical
Th app. msg

Transport Layer: 3-8


Two principal Internet transport protocols
application
transport

 TCP: Transmission Control Protocol mobile


network
network
data link
physical
national or global ISP
• reliable, in-order delivery

log
• congestion control

ica
le
• flow control

n d-
e nd
• connection setup local or

tra
regional ISP
 UDP: User Datagram Protocol

nsp
ort
home network
• unreliable, unordered delivery content
provider
network
• no-frills extension of “best-effort” IP application
transport
datacenter
network
network

 services not available: data link


physical

• delay guarantees enterprise


network
• bandwidth guarantees
Transport Layer: 3-9
Chapter 3: roadmap
 Transport-layer services
 Multiplexing and demultiplexing
 Connectionless transport: UDP
 Principles of reliable data transfer
 Connection-oriented transport: TCP
 Principles of congestion control
 TCP congestion control
 Evolution of transport-layer
functionality
Transport Layer: 3-10
HTTP server
client
application application
HTTP msg
transport

transport network transport


network link network
link physical link
physical physical

Transport Layer: 3-11


HTTP server
client
application application
HTTP msg
Ht HTTP msg
transport

transport network transport


network link network
link physical link
physical physical

Transport Layer: 3-12


HTTP server
client
application application
HTTP msg
Ht HTTP msg
transport
Hnnetwork
Ht HTTP msg
transport transport
network link network
link physical link
physical physical

Transport Layer: 3-13


HTTP server
client
application application

transport

transport network transport


network link network
link physical link
physical physical

Hn Ht HTTP msg

Transport Layer: 3-14


HTTP server
client1 client2
application P-client1 P-client2 application

transport

transport network transport


network link network
link physical link
physical physical

Transport Layer: 3-15


Multiplexing/demultiplexing
multiplexing at sender: demultiplexing at receiver:
handle data from multiple use header info to deliver
sockets, add transport header received segments to correct
(later used for demultiplexing) socket

application

application P1 P2 application socket


P3 transport P4
process
transport network transport
network link network
link physical link
physical physical

Transport Layer: 3-16


How demultiplexing works
 host receives IP datagrams 32 bits
• each datagram has source IP source port # dest port #
address, destination IP address
• each datagram carries one other header fields
transport-layer segment
• each segment has source,
application
destination port number data
 host uses IP addresses & port (payload)
numbers to direct segment to
appropriate socket TCP/UDP segment format

Transport Layer: 3-17


Connectionless demultiplexing
Recall: when receiving host receives
 when creating socket, must UDP segment:
specify host-local port #: • checks destination port # in
segment
DatagramSocket mySocket1 = new
DatagramSocket(12534); • directs UDP segment to
socket with that port #
 when creating datagram to
send into UDP socket, must
IP/UDP datagrams with same dest.
specify port #, but different source IP
• destination IP address addresses and/or source port
• destination port # numbers will be directed to same
socket at receiving host
Transport Layer: 3-18
Connectionless demultiplexing: an example
DatagramSocket
serverSocket = new
DatagramSocket
DatagramSocket mySocket2 = DatagramSocket mySocket1 =
new DatagramSocket (6428); new DatagramSocket (5775);
(9157); application
application P1 application
P3 P4
transport
transport transport
network
network link network
link physical link
physical physical

source port: 6428 source port: ?


dest port: 9157 dest port: ?

source port: 9157 source port: ?


dest port: 6428 dest port: ?
Transport Layer: 3-19
Connection-oriented demultiplexing
 TCP socket identified by  server may support many
4-tuple: simultaneous TCP sockets:
• source IP address • each socket identified by its
• source port number own 4-tuple
• dest IP address • each socket associated with
• dest port number a different connecting client
 demux: receiver uses all
four values (4-tuple) to
direct segment to
appropriate socket
Transport Layer: 3-20
Connection-oriented demultiplexing: example
application
application P4 P5 P6 application
P1 P2 P3
transport
transport transport
network
network link network
link physical link
physical server: IP physical
address B

host: IP source IP,port: B,80 host: IP


address A dest IP,port: A,9157 source IP,port: C,5775 address C
dest IP,port: B,80
source IP,port: A,9157
dest IP, port: B,80
source IP,port: C,9157
dest IP,port: B,80
Three segments, all destined to IP address: B,
dest port: 80 are demultiplexed to different sockets
Transport Layer: 3-21
Port numbers
 A port number is a 16-bit number,
ranging from 0 to 65535
• Well-known port numbers
• Registered port numbers
• Private/Dynamic port numbers
also called ephemeral ports
 Port numbers are assigned by
Internet Assigned Number
Authority (IANA )
• To check active TCP and UDP
ports: >netstat -a
https://whilenetworking.com/2016/09/03/standard-tcp-ip-port-important-port-numbers/
Transport Layer: 3-22
Summary
 Multiplexing, demultiplexing: based on segment, datagram
header field values
 UDP: demultiplexing using destination port number (only)
 TCP: demultiplexing using 4-tuple: source and destination IP
addresses, and port numbers
 Multiplexing/demultiplexing happen at all layers

Transport Layer: 3-23


Chapter 3: roadmap
 Transport-layer services
 Multiplexing and demultiplexing
 Connectionless transport: UDP
 Principles of reliable data transfer
 Connection-oriented transport: TCP
 Principles of congestion control
 TCP congestion control
 Evolution of transport-layer
functionality
Transport Layer: 3-24
UDP: User Datagram Protocol
 “no frills,” “bare bones”
Why is there a UDP?
Internet transport protocol  no connection
establishment (which can
 “best effort” service, UDP add RTT delay)
segments may be:  simple: no connection state
• lost at sender, receiver
• delivered out-of-order to app  small header size
 connectionless:  no congestion control
 UDP can blast away as fast as
• no handshaking between UDP desired!
sender, receiver  can function in the face of
• each UDP segment handled congestion
independently of others
Transport Layer: 3-25
UDP: User Datagram Protocol
 UDP use:
 streaming multimedia apps (loss tolerant, rate sensitive)
 DNS
 SNMP
 HTTP/3
 if reliable transfer needed over UDP (e.g., HTTP/3):
 add needed reliability at application layer
 add congestion control at application layer

Transport Layer: 3-26


UDP: User Datagram Protocol [RFC 768]

Transport Layer: 3-27


UDP: Transport Layer Actions

SNMP client SNMP server

application application

transport transport
(UDP) (UDP)

network (IP) network (IP)

link link

physical physical

Transport Layer: 3-28


UDP: Transport Layer Actions

SNMP client SNMP server


UDP sender actions:
application  is passed an application- SNMP msg
application
layer message
transport  determines UDP segment UDPhtransport
UDP h SNMP msg

(UDP) header fields values (UDP)

network (IP)
 creates UDP segment network (IP)

link
 passes segment to IP link

physical physical

Transport Layer: 3-29


UDP: Transport Layer Actions

SNMP client SNMP server


UDP receiver actions:
application  receives segment from IP application
 checks UDP checksum
transport transport
SNMP msg header value
(UDP)  extracts application-layer (UDP)

network
UDP h SNMP(IP)
msg message network (IP)
 demultiplexes message up
link to application via socket link

physical physical

Transport Layer: 3-30


UDP segment header
32 bits
source port # dest port #
length checksum

application length, in bytes of


data UDP segment,
(payload) including header

data to/from
UDP segment format application layer

Transport Layer: 3-31


UDP checksum
Goal: detect errors (i.e., flipped bits) in transmitted segment
1st number 2nd number sum

Transmitted: 5 6 11

Received: 4 6 11

receiver-computed
checksum
= sender-computed
checksum (as received)

Transport Layer: 3-32


UDP checksum
Goal: detect errors (i.e., flipped bits) in transmitted segment
sender: receiver:
 treat contents of UDP  compute checksum of received
segment (including UDP header segment
fields and IP addresses) as
sequence of 16-bit integers  check if computed checksum equals
 checksum: addition (one’s checksum field value:
complement sum) of segment • Not equal - error detected
content • Equal - no error detected. But maybe
 checksum value put into errors nonetheless? More later ….
UDP checksum field
Transport Layer: 3-33
https://www.rfc-editor.org/info/rfc1071
Internet checksum: an example
example: add two 16-bit integers
1110011001100110
1101010101010101
wraparound 11011101110111011

sum 1011101110111100
Checksum 0100010001000011
1 complement of sum
Note: when adding numbers, a carryout from the most significant bit needs to be
added to the result
Check the correctness: add the check sum value with the sum of two integers. If
the result is 1 for all bits then accept otherwise reject it.
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1: Accept otherwise Reject Transport Layer: 3-34
Internet checksum: weak protection!
example: add two 16-bit integers
01
1110011001100110 10
1101010101010101
wraparound 11011101110111011 Even though
numbers have
sum 1011101110111100 changed (bit
flips), no change
checksum 0100010001000011 in checksum!

Transport Layer: 3-35


Summary: UDP
 “no frills” protocol:
• segments may be lost, delivered out of order
• best effort service: “send and hope for the best”
 UDP has its plusses:
• no setup/handshaking needed (no RTT incurred)
• can function when network service is compromised
• helps with reliability (checksum)
 build additional functionality on top of UDP in application layer
(e.g., HTTP/3)
Thank You All

A note on the origin of these ppt slides:


? 

All material copyright 1996-2020 J.F Kurose and K.W. Ross, All Rights Reserved Transport Layer: 3-150
These slides are freely provided by the book authors and it represents a lot of work on their part. We would like to thank J.F Kurose and K.W. Ross.

You might also like