Transcript Lesson 12

Transport Protocols
Lesson 12
NETS2150/2850
http://www.ug.cs.usyd.edu.au/~nets2150/
School of Information Technologies
1
Lesson Outcome

understand principles behind transport layer
services:





multiplexing/demultiplexing
reliable data transfer
flow control
congestion control
learn about transport layer protocols in the
Internet:


UDP: connectionless transport
TCP: connection-oriented transport
2
Position of transport layer
3
Transport layer duties
4
Transport services and protocols


provide logical communication
between app processes
running on different hosts
transport protocols run in end
systems


(not in ISs)
send side: breaks app
messages into segments,
passes to network layer
rcv side: reassembles
segments into messages,
passes to app. layer
application
transport
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
application
transport
network
data link
physical
5
Transport vs. Network Layer


network layer: logical communication
between hosts
transport layer: logical communication
between processes

relies on, enhances, network layer services
6
Types of data deliveries
7
TCP & UDP

Transmission Control
Protocol



SCTP
User Datagram
Protocol (UDP)



Connection oriented
RFC 793
Connectionless
RFC 768
Stream Control
Transmission Protocol
(SCTP) – for VoIP
Some protocols in the
TCP/IP protocol suite
8
IP addresses & port numbers
Port Numbers
IP addresses versus port numbers
9
Well-known ports
Port
Protocol
Description
7
Echo
Echoes a received datagram back to the sender
9
Discard
11
Users
13
Daytime
17
Quote
19
Chargen
20
FTP, Data
21
FTP, Control
23
TELNET
25
SMTP
53
DNS
67
BOOTP
79
Finger
Finger
80
HTTP
Hypertext Transfer Protocol
111
RPC
161
SNMP
Discards any datagram that is received
Active users
Returns the date and the time
Returns a quote of the day
Returns a string of characters
File Transfer Protocol (data connection)
File Transfer Protocol (control connection)
Terminal Network
Simple Mail Transfer Protocol
Domain Name Server
Bootstrap Protocol
Remote Procedure Call
Simple Network Management Protocol
10
Internet transport-layer protocols

reliable, in-order
delivery (TCP)




congestion control
flow control
connection setup
unreliable, unordered
delivery: UDP

extension of “besteffort” IP
application
transport
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
application
transport
network
data link
physical
11
Issues in a Simple Transport
Protocol



Multiplexing and Addressing
Flow Control
Connection establishment and
termination
12
Socket Address
Process-to-process delivery needs two IDs at each
end:
- IP address
- Port number
13
Multiplexing/Demultiplexing
Multiplexing at send host:
Demultiplexing at rcv host:
gathering data from multiple
sockets, enveloping data with
header (later used for
demultiplexing)
delivering received segments
to correct socket/process
14
How Demultiplexing Works


host receives IP packets
 each packet has source IP
address, destination IP
address
 each packet carries 1
transport-layer segment
 each segment has source,
destination port number
host uses IP addresses & port
numbers to direct segment to
appropriate socket
32 bits
source port #
dest port #
other header fields
application
data
(message)
TCP/UDP segment format
15
Connectionless demultiplexing

UDP socket identified by two-tuple:
(dest IP address, dest port number)
 When host receives UDP segment:



checks destination port number in segment
directs UDP segment to socket with that port
number
IP packets with different source IP addresses
and/or source port numbers directed to same
socket
16
Connectionless demux (cont)
Eg.: UDP
P2
SP: 6428
SP: 6428
DP: 9157
DP: 5775
SP: 9157
client
IP: A
P1
P1
P3
DP: 6428
SP: 5775
server
IP: C
DP: 6428
Client
IP:B
SP provides “return address”
17
Connection-oriented demux

TCP socket identified
by 4-tuple:






source IP address
source port number
dest IP address
dest port number
recv host uses all
four values to direct
segment to
appropriate socket
Server host may
support many
simultaneous TCP
sockets:


each socket identified
by its own 4-tuple
E.g.: Web servers
have different sockets
for each connecting
client
18
Connection-oriented demux
(cont)
Eg.: TCP
P2
P3
SP: 80
SP: 80
DP: 9157
DP: 5775
SP: 9157
client
IP: A
DP: 80
P1
P1
P4
SP: 5775
server
IP: C
DP: 80
Client
IP:B
19
TCP Flow Control
flow control

sender won’t overflow
receiver’s buffer by
transmitting too much,
too fast
receive side of TCP
connection has a
receive buffer:


app process may be
slow at reading from
buffer
speed-matching
service: matching
the send rate to the
receiving app’s drain
rate
J. Kurose and Ross, Computer Networking
20
Connection Establishment and
Termination




Allow each end to know the other exists
Negotiation of optional parameters by
mutual agreement (3-way handshake)
Triggers allocation of transport entity
resources
Only in TCP
21
UDP: User Datagram Protocol



“bare bones” Internet
transport protocol
Best-effort service, UDP
segments may be:
 lost
 delivered out of order to
app
connectionless:


no handshaking between
UDP sender, receiver
each UDP segment
handled independently of
others
[RFC 768]
Why is there a UDP?




fast: no connection
establishment (which
can add delay)
simple: no connection
state at sender, receiver
small segment header
no congestion control:
UDP can blast away as
fast as desired
22
UDP (2)


often used for
streaming multimedia
apps
 loss tolerant
other UDP uses



DNS (domain name
resolution)
SNMP (network
management)
Need to perform
application-specific
error recovery!
32 bits
Length, in
octets,
including
header
source port #
dest port #
length
checksum
Application
data
(message)
UDP segment format
23
24
TCP: Overview

point-to-point:



RFCs: 793, 1122, 1323,
2018, 2581

one sender, one
receiver


reliable, in-order
send & receive
buffers

socket
door
application
reads data
TCP
send buffer
TCP
receive buffer
socket
door
bi-directional data flow in
same connection
Specifies maximum
segment size (MSS)
connection-oriented:


application
writes data
full duplex data:
handshaking (exchange of
control msgs) init’s
sender, receiver state
before data exchange
flow controlled:

sender will not overwhelm
receiver
segment
25
TCP segment structure
32 bits
URG: urgent data
(generally not used)
ACK: ACK #
valid
PSH: push data now
(generally not used)
RST, SYN, FIN:
connection estab
(setup, teardown
commands)
Internet
checksum
(as in UDP)
source port #
dest port #
sequence number
acknowledgement number
head not
UA P R S F
len used
checksum
Receive window
Urg data pnter
Options (variable length)
application
data
(variable length)
J. Kurose and Ross, Computer Networking
26
TCP seq. #’s and ACKs
Seq. #’s:
 byte stream
“number” of first
octet in
segment’s data
ACKs:
 seq # of next
octet expected
from other side
 cumulative ACK
Host A
User
types
‘C’
Host B
host ACKs
receipt of
‘C’, echoes
back ‘C’
host ACKs
receipt
of echoed
‘C’
simple Telnet scenario
time
27
TCP Connection Management
Three way handshake:
Recall: TCP sender,

receiver establish
“connection” before
exchanging data
segments
initialize TCP
variables:
 seq. #s
 buffers, flow
control info (e.g.
RcvWindow)
Step 1: client host sends TCP
SYN segment to server
 specifies initial seq #
 no data
Step 2: server host receives
SYN, replies with SYNACK
segment
server allocates buffers
 specifies server initial
seq. #
Step 3: client receives
SYNACK, replies with ACK
segment, which may
28
contain data

TCP Connection Management (cont.)
Closing a connection:
Step 1: client end system
client
close
sends TCP FIN control
segment to server
close
Step 3: client receives FIN,
replies with ACK.
Step 4: server, receives ACK.
Connection closed.
timed wait
Step 2: server receives FIN,
replies with ACK. Closes
connection, sends FIN.
server
closed
29
TCP Connection Management (cont.)
Could be
combined
(3-way)
Setup
Termination
30
Principles of Congestion Control
Congestion:




informally: “too many sources sending too
much data too fast for network to handle”
different from flow control!!
manifestations:
 lost packets (buffer overflow at routers)
 long delays (queueing in router buffers)
a top-10 problem!
31
TCP congestion control



There is no explicit feedback from network
Congestion inferred from end-system
observed loss, delay
When this happens, TCP reduces its
window size


Using CWnd and RcvWnd
More details in NETS3303/3603!
32
Summary


Transport layer establishes the
process-to-process communication
TCP uses reliable, connection oriented
approach


UDP uses unreliable, connectionless approach


Used by FTP, HTTP, Telnet apps
Used by DNS, SNMP and streaming apps like
Realplayer and MS Windows Media Player
Stallings 20.1, 20.2 and 204.
33