You are on page 1of 22

Chapter 3

Transport Layer
Part 1

A note on the use of these Powerpoint slides:


We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you see the animations; and can add, modify,
and delete slides (including this one) and slide content to suit your needs.

Computer
They obviously represent a lot of work on our part. In return for use, we only
ask the following:

 If you use these slides (e.g., in a class) that you mention their source
(after all, we’d like people to use our book!)
Networking: A Top
 If you post any slides on a www site, that you note that they are adapted
from (or perhaps identical to) our slides, and note our copyright of this
Down Approach
material.
7th edition
Thanks and enjoy! JFK/KWR
Jim Kurose, Keith Ross
All material copyright 1996-2016 Pearson/Addison Wesley
J.F Kurose and K.W. Ross, All Rights Reserved April 2016
Transport Layer 2-1
Chapter 3: Transport Layer
our goals:
 understand principles  learn about Internet
behind transport transport layer protocols:
layer services: • UDP: connectionless
• reliable data transfer transport
• flow control • TCP: connection-oriented
• congestion control reliable transport
• TCP congestion control

Transport Layer 3-2


Chapter 3 outline
3.1 transport-layer 3.5 connection-oriented
services transport: TCP
3.2 connectionless • segment structure
transport: UDP • reliable data transfer
3.3 principles of reliable • flow control
data transfer • connection management
3.6 principles of 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
segments into messages, transport
network
passes to app layer data link
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
between hosts 12 kids in Ann’s house sending
letters to 12 kids in Bill’s
 transport layer: house:
logical  hosts = houses
communication  processes = kids
between processes  app messages = letters in
envelopes
• relies on, network  transport protocol = Ann
layer services and Bill who demux to in-
house siblings
 network-layer protocol =
postal service

Transport Layer 3-5


Internet transport-layer protocols
application
 reliable, in-order transport
network

delivery (TCP) data link


physical
network

• congestion control network


data link
data link
physical
physical
• flow control network
data link

• connection setup physical

network

 unreliable, unordered data link


physical

delivery: UDP network


data link
physical
• no-frills extension of network
data link application
“best-effort” IP physical
network
data link
transport
network
data link
 services not available: physical
physical

• delay guarantees
• bandwidth guarantees

Transport Layer 3-6


Multiplexing/demultiplexing
multiplexing at sender:
handle data from multiple demultiplexing at receiver:
sockets, add transport header use header info to deliver
(later used for demultiplexing) received segments to correct
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-8


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 and
destination port number application
 host uses IP addresses & port data
numbers to direct segment to (payload)
appropriate socket
TCP/UDP segment format

Transport Layer 3-9


Connectionless demultiplexing
 recall: created socket has  recall: when creating
host-local port #: datagram to send into UDP
DatagramSocket mySocket1 socket, must specify
= new DatagramSocket(12534);
• destination IP address
• destination port #

 when host receives UDP IP datagrams with same


segment: dest. port #, but different
• checks destination port # source IP addresses
in segment and/or source port
numbers will be directed
• directs UDP segment to to same socket at dest
socket with that port #

Transport Layer 3-10


Connectionless demux: example
DatagramSocket
DatagramSocket serverSocket = new
DatagramSocket DatagramSocket
mySocket2 = new mySocket1 = new
DatagramSocket (6428); DatagramSocket
(9157); application
(5775);
application application
P1
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-13
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
 demux: receiver uses all different sockets for
four values to direct each connecting client
segment to appropriate
socket

Transport Layer 3-14


Connection-oriented demux: example

application
application P4 P5 P6 application
P3 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-15
Connection-oriented demux: example
threaded server
application
application application
P4
P3 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

Transport Layer 3-16


Chapter 3 outline
3.1 transport-layer 3.5 connection-oriented
services transport: TCP
3.2 connectionless • segment structure
transport: UDP • reliable data transfer
3.3 principles of reliable • flow control
data transfer • connection management
3.6 principles of congestion
control
3.7 TCP congestion control

Transport Layer 3-18


UDP: User Datagram Protocol [RFC 768]
 “no frills,” “bare bones”  UDP use:
Internet transport  streaming multimedia
protocol apps (loss tolerant, rate
 “best effort” service, UDP sensitive)
segments may be:  DNS
• lost  SNMP
• delivered out-of-order  reliable transfer over
to app UDP:
 connectionless:  add reliability at
• no handshaking application layer
between UDP sender,  application-specific error
receiver recovery!
• each UDP segment is
handled independently
of others
Transport Layer 3-19
UDP: segment header
length, in bytes of
32 bits UDP segment,
source port # dest port # including header

length checksum
why is there a UDP?
 no connection
application establishment (which can
data add delay)
(payload)  simple: no connection
state at sender, receiver
 small header size
UDP segment format  no congestion control:
UDP can blast away as fast
as desired

Transport Layer 3-20


UDP checksum
Goal: detect “errors” (e.g., flipped bits) in transmitted
segment
sender: receiver:
 treat segment contents,  compute checksum of received
including header fields, as segment
sequence of 16-bit integers
 check if computed checksum
 checksum: addition (one’s equals checksum field value:
complement sum) of segment
contents • NO - error detected
 sender puts checksum value • YES - no error detected.
into UDP checksum field

Transport Layer 3-21


UDP checksum: example 1
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

Note: when adding numbers, a carryout from the most


significant bit needs to be added to the result

* Check out the online interactive exercises for more


examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ Transport Layer 3-22
UDP checksum: example 2
example: add three 16-bit integers

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

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

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

Sum= ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Checksum= 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

* Check out the online interactive exercises for more


examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ Transport Layer 3-23
UDP checksum: example 2
example: add three 16-bit integers

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

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

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

Sum= 1 0 1 1 0 0 1 1 1 0 1 1 0 0 0 0

Checksum= 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Note: Checksum is 1’s complement of the Sum.

* Check out the online interactive exercises for more


examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ Transport Layer 3-24
UDP checksum: example 2
example: add three 16-bit integers

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

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

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

Sum= 1 0 1 1 0 0 1 1 1 0 1 1 0 0 0 0

Checksum= 1 0 1 0 0 1 1 0 0 0 1 0 0 1 1 1 1

Note: Checksum is 1’s complement of the Sum.

* Check out the online interactive exercises for more


examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ Transport Layer 3-25
Chapter 3 outline
3.1 transport-layer 3.5 connection-oriented
services transport: TCP
3.2 multiplexing and • segment structure
demultiplexing • reliable data transfer
3.3 connectionless • flow control
transport: UDP • connection management
3.4 principles of reliable 3.6 principles of congestion
data transfer control
3.7 TCP congestion control

Transport Layer 3-26

You might also like