You are on page 1of 19

Chapter 3

Transport Layer

A note on the use of these ppt slides:


We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you can add, modify, and delete slides
(including this one) and slide content to suit your needs. They obviously
Computer Networking:
represent a lot of work on our part. In return for use, we only ask the A Top Down Approach
following:
 If you use these slides (e.g., in a class) in substantially unaltered form,
5th edition.
that you mention their source (after all, we’d like people to use our book!) Jim Kurose, Keith Ross
 If you post any slides in substantially unaltered form on a www site, that
you note that they are adapted from (or perhaps identical to) our slides, and
Addison-Wesley, April
note our copyright of this material. 2009.
Thanks and enjoy! JFK/KWR

All material copyright 1996-2009


J.F Kurose and K.W. Ross, All Rights Reserved
Transport Layer 3-1
Chapter 3: Transport Layer
Our goals:
 understand principles  learn about transport
behind transport layer protocols in the
layer services: Internet:
 multiplexing/demultipl  UDP: connectionless
exing transport
 reliable data transfer  TCP: connection-oriented
 flow control transport
 congestion control  TCP congestion control

Transport Layer 3-2


Chapter 3 outline
 3.1 Transport-layer  3.5 Connection-oriented
services transport: TCP
 3.2 Multiplexing and  segment structure
demultiplexing  reliable data transfer
flow control
 3.3 Connectionless

connection management
transport: UDP 

 3.6 Principles of
 3.4 Principles of
reliable data transfer congestion control
 3.7 TCP congestion
control

Transport Layer 3-3


Transport services and protocols
application
transport
 provide logical communication network
data link
between app processes physical

running on different hosts


 transport protocols run in
end systems
 send side: breaks app
messages into segments,
passes to network layer
 rcv side: reassembles application
transport
segments into messages, network
data link
passes to app layer physical

 more than one transport


protocol available to apps
 Internet: TCP and UDP

Transport Layer 3-4


Transport vs. network layer
 network layer: logical Household analogy:
communication 12 kids sending letters to
between hosts 12 kids
 transport layer: logical  processes = kids
communication  app messages = letters
between processes in envelopes
relies on, enhances,
 hosts = houses

network layer services
 transport protocol =
Ann and Bill
 network-layer protocol
= postal service

Transport Layer 3-5


Internet transport-layer protocols
 reliable, in-order
application
transport
network
delivery (TCP) data link
physical
network
 congestion control data link
network
physical
data link
 flow control physical

 connection setup
 unreliable, unordered
network
data link
physicalnetwork
delivery: UDP data link
physical
 no-frills extension of network
data link
“best-effort” IP
application
physical network transport
data link network
 services not available:
physical data link
physical

 delay guarantees
 bandwidth guarantees

Transport Layer 3-6


Chapter 3 outline
 3.1 Transport-layer  3.5 Connection-oriented
services transport: TCP
 3.2 Multiplexing and  segment structure
demultiplexing  reliable data transfer
flow control
 3.3 Connectionless

connection management
transport: UDP 

 3.6 Principles of
 3.4 Principles of
reliable data transfer congestion control
 3.7 TCP congestion
control

Transport Layer 3-7


Multiplexing/demultiplexing
Demultiplexing at rcv host: Multiplexing at send host:
gathering data from multiple
delivering received segments
sockets, enveloping data with
to correct socket
header (later used for
demultiplexing)
= socket = process

P3 P1
P1 P2 P4 application
application application

transport transport transport

network network network

link link link

physical physical physical

host 2 host 3
host 1
Transport Layer 3-8
How demultiplexing works
 host receives IP datagrams
 each datagram has source 32 bits
IP address, destination IP
address source port # dest port #

 each datagram carries 1


transport-layer segment other header fields
 each segment has source,
destination port number
 host uses IP addresses & port application
numbers to direct segment to data
appropriate socket (message)

TCP/UDP segment format

Transport Layer 3-9


Connectionless demultiplexing
 When host receives UDP
 Create sockets with port
segment:
numbers:
DatagramSocket mySocket1 = new  checks destination port
DatagramSocket(12534); number in segment
DatagramSocket mySocket2 = new  directs UDP segment to
DatagramSocket(12535); socket with that port
number
 UDP socket identified by
two-tuple:  IP datagrams with
different source IP
(dest IP address, dest port number)
addresses and/or source
port numbers directed
to same socket

Transport Layer 3-10


Connectionless demux (cont)
DatagramSocket serverSocket = new DatagramSocket(6428);

P2 P1
P1
P3

SP: 6428 SP: 6428


DP: 9157 DP: 5775

SP: 9157 SP: 5775


client DP: 6428 DP: 6428 Client
server
IP: A IP: C IP:B

SP provides “return address”

Transport Layer 3-11


Connection-oriented demux
 TCP socket identified  Server host may support
by 4-tuple: many simultaneous TCP
 source IP address sockets:
 source port number  each socket identified by
 dest IP address its own 4-tuple
 dest port number  Web servers have
 recv host uses all four different sockets for
values to direct each connecting client
segment to appropriate  non-persistent HTTP will
socket have different socket for
each request

Transport Layer 3-12


Connection-oriented demux
(cont)

P1 P4 P5 P6 P2 P1P3

SP: 5775
DP: 80
S-IP: B
D-IP:C

SP: 9157 SP: 9157


client DP: 80 DP: 80 Client
server
IP: A S-IP: A
IP: C S-IP: B IP:B
D-IP:C D-IP:C

Transport Layer 3-13


Connection-oriented demux:
Threaded Web Server

P1 P4 P2 P1P3

SP: 5775
DP: 80
S-IP: B
D-IP:C

SP: 9157 SP: 9157


client DP: 80 DP: 80 Client
server
IP: A S-IP: A
IP: C S-IP: B IP:B
D-IP:C D-IP:C

Transport Layer 3-14


Chapter 3 outline
 3.1 Transport-layer  3.5 Connection-oriented
services transport: TCP
 3.2 Multiplexing and  segment structure
demultiplexing  reliable data transfer
flow control
 3.3 Connectionless

connection management
transport: UDP 

 3.6 Principles of
 3.4 Principles of
reliable data transfer congestion control
 3.7 TCP congestion
control

Transport Layer 3-15


UDP: User Datagram Protocol [RFC 768]
 “no frills,” “bare bones”
Internet transport Why is there a UDP?
protocol
 no connection
 “best effort” service, UDP establishment (which can
segments may be: add delay)
 lost  simple: no connection state
 delivered out of order at sender, receiver
to app  small segment header
 connectionless:  no congestion control: UDP
 no handshaking between can blast away as fast as
UDP sender, receiver desired
 each UDP segment
handled independently
of others

Transport Layer 3-16


UDP: more
 often used for streaming
multimedia apps 32 bits

 loss tolerant Length, in source port # dest port #


 rate sensitive bytes of UDP length checksum
segment,
 other UDP uses including
 DNS header
 SNMP
 reliable transfer over UDP: Application
add reliability at data
application layer (message)
 application-specific
error recovery!
UDP segment format

Transport Layer 3-17


UDP checksum
Goal: detect “errors” (e.g., flipped bits) in transmitted
segment

Sender: Receiver:
 treat segment contents  compute checksum of
as sequence of 16-bit received segment
integers  check if computed checksum
 checksum: addition (1’s equals checksum field value:
complement sum) of  NO - error detected
segment contents  YES - no error detected.
 sender puts checksum But maybe errors
value into UDP checksum nonetheless? More later
field ….

Transport Layer 3-18


Internet Checksum Example
 Note
 When adding numbers, a carryout from the
most significant bit needs to be added to the
result
 Example: add two 16-bit integers

1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1

sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
Transport Layer 3-19

You might also like