ppt

Transport Layer
Computer Networks
Autumn 2000
John Kristoff
1
Where are we?
Autumn 2000
John Kristoff
2
Recall
Ñ Network Layer
ÑProvides host-to-host communication
ÑSource and destination addresses identify
host interfaces
Ñ Machine-to-machine networking
Autumn 2000
John Kristoff
3
Transport Protocols
Ñ
Ñ
Ñ
Ñ
Provide application-to-application
communication
Need extended addressing mechanism to
identify applications
Called end-to-end
Optionally provide:
ÑReliability
ÑFlow Control
ÑCongestion Control
Autumn 2000
John Kristoff
4
Example Transport Layer:
Transmission Control Protocol (TCP)
Ñ
Ñ
Ñ
Ñ
Ñ
Ñ
Ñ
Standardized by IETF as RFC 793
Most popular layer 4 protocol
Connection-oriented protocol
Conceptually between applications and IP
Full-duplex operation
Byte-stream interface
Of utmost importance for this class!
Ñ The book: TCP/IP Illustrated, Volume I - W.R. Stevens
Ñ Also see: http://condor.depaul.edu/~jkristof/tcp.html
Autumn 2000
John Kristoff
5
TCP Feature Summary
Provides a completely reliable (no data
duplication or loss), connection-oriented,
full-duplex stream transport service that
allows two application programs to form a
connection, send data in either direction
and then terminate the connection.
Autumn 2000
John Kristoff
6
Relationship Between TCP
and Other Protocols
Ñ
TCP on one computer uses IP to communicate
with TCP on another computer
Autumn 2000
John Kristoff
7
Apparent Contradiction
Ñ IP offers best-effort (unreliable) delivery
Ñ TCP uses IP
Ñ TCP provides completely reliable transfer
Ñ How is this possible?
Autumn 2000
John Kristoff
8
Achieving Reliability
Ñ Reliable connection setup
Ñ Reliable data transmission
Ñ Reliable connection shutdown
Autumn 2000
John Kristoff
9
Reliable Data
Transmission
Ñ Positive Acknowledgement
Ñ Receiver returns short message when data arrives
Ñ Call an acknowledgement
Ñ Retransmission
Ñ Sender starts timer whenever message is transmitted
Ñ If timer expires before acknowledgement arrives,
sender retransmits message
Autumn 2000
John Kristoff
10
Retransmission Illustrated
Autumn 2000
John Kristoff
11
How Long Should TCP Wait
Before Retransmitting?
Ñ Time for acknowledgement to arrive
depends on
ÑDistance to destination
ÑCurrent traffic conditions
Ñ Multiple connections can be open
simultaneously
Ñ Traffic conditions change rapidly
Autumn 2000
John Kristoff
12
Important Point
The delay required for data to reach a destination and an
acknowledgement to return depends on traffic in the
internet as well as the distance to the destination. Since
it allows multiple application programs to communicate
with multiple destinations concurrently, TCP must handle
a variety of delays that can change rapidly.
Autumn 2000
John Kristoff
13
Solving the Retransmission
Problem
Ñ Keep estimate of round trip time on each
connection
Ñ Use current estimate to set retransmission
timer
Ñ Known as adaptive retransmission
Ñ Key to TCP’s success
Autumn 2000
John Kristoff
14
Adaptive Retransmission
Illustrated
Ñ
Timeout depends on current round-trip estimate
Autumn 2000
John Kristoff
15
TCP Flow Control
Ñ Receiver
ÑAdvertises available buffer space
ÑCalled the window
Ñ Sender
ÑCan send up to entire window before ACK
arrives
Ñ Also called a sliding window protocol
Autumn 2000
John Kristoff
16
Window Advertisement
Ñ Each acknowledgement carries new
window information
ÑCalled window advertisement
ÑCan be zero (called closed window)
Ñ Interpretation: I have received up through
X and can take Y more octets
Autumn 2000
John Kristoff
17
Window Advertisement
Illustrated
Autumn 2000
John Kristoff
18
Another View: Sliding
Window Illustrated
Autumn 2000
John Kristoff
19
Startup and Shutdown
Ñ Connection Startup
ÑMust be reliable
Ñ Connection Shutdown
ÑMust be graceful
Ñ Difficult
Autumn 2000
John Kristoff
20
Why Startup/Shutdown is
Difficult
Ñ Segments can be
Ñ lost
Ñ duplicated
Ñ delayed
Ñ delivered out of order
Ñ either side can crash
Ñ either side can reboot
Ñ Need to avoid duplicate shutdown
"message”from affecting later connection
Autumn 2000
John Kristoff
21
TCP’s Startup Solution
Ñ Use three-message exchange
Ñ Known as the 3-way handshake
Ñ Necessary and sufficient for unambiguous,
reliable startup
Ñ SYN messages used for connection
establishment
Autumn 2000
John Kristoff
22
3-Way Handshake
Illustrated
Autumn 2000
John Kristoff
23
TCP’s Shutdown Illustrated
Autumn 2000
John Kristoff
24
Byte Stream Sequencing
Ñ
Ñ
Ñ
Ñ
Ñ
Segments are labeled with a sequence number
Protects from out-of-order delivery
32-bit number
Limited size of byte stream?
Initial Sequence Numbers (ISNs) must be
exchanged at TCP connection establishment
Autumn 2000
John Kristoff
25
More Complete Illustration
of the 3-Way Handshake
Autumn 2000
John Kristoff
26
Application Multiplexing
Ñ Cannot extend IP address
ÑNo unused bits
Ñ Cannot use OS dependent quantity
ÑProcess ID
ÑTask number
ÑJob name
Ñ Must work on all computer systems
Autumn 2000
John Kristoff
27
Application Multiplexing
Illustrated
Autumn 2000
John Kristoff
28
Protocol Ports
Ñ
Ñ
Each application assigned a unique integer
Server
Ñ Follows standard
Ñ Always uses same port number
Ñ Usually uses lower port numbers
Ñ
Client
Ñ Obtains unused port from protocol software
Ñ Usually uses higher port numbers
Autumn 2000
John Kristoff
29
Protocol Port Example
Ñ
Ñ
Ñ
Web server application is assigned port 80
Web client application obtains port 32938
TCP segment sent from client to server has
Ñ source port number 32938
Ñ destination port number 80
Ñ
When web server responds, TCP segment has
Ñ source port number 80
Ñ destination port number 32938
Autumn 2000
John Kristoff
30
Standard Protocol Ports
Ñ See http://www.iana.org for standard protocol port assignments
Ñ
See /etc/services in UNIX systems and \winnt\system32\drivers\etc\services in Windows NT
Autumn 2000
John Kristoff
31
TCP Segment Format
Autumn 2000
John Kristoff
32
Example Transport Layer:
User Datagram Protocol (UDP)
Ñ Unreliable message delivery
Ñ Connectionless protocol
Ñ No flow control (no window)
Ñ No error recovery (no ACKs)
Ñ Provides application multiplexing
Ñ Error detection optional (checksum field)
Autumn 2000
John Kristoff
33
UDP Message Format
Autumn 2000
John Kristoff
34