Download Chapter 6: The Transport Layer

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts

Piggybacking (Internet access) wikipedia, lookup

Cracking of wireless networks wikipedia, lookup

Distributed firewall wikipedia, lookup

List of wireless community networks by region wikipedia, lookup

Airborne Networking wikipedia, lookup

Recursive InterNetwork Architecture (RINA) wikipedia, lookup

Zero-configuration networking wikipedia, lookup

Computer network wikipedia, lookup

Deep packet inspection wikipedia, lookup

IEEE 1355 wikipedia, lookup

Wake-on-LAN wikipedia, lookup

Real-Time Messaging Protocol wikipedia, lookup

UniPro protocol stack wikipedia, lookup

Internet protocol suite wikipedia, lookup

TCP congestion control wikipedia, lookup

Remote Desktop Services wikipedia, lookup

Lag wikipedia, lookup

AppleTalk wikipedia, lookup

Asynchronous Transfer Mode wikipedia, lookup

SIP extensions for the IP Multimedia Subsystem wikipedia, lookup

RapidIO wikipedia, lookup

Point-to-Point Protocol over Ethernet wikipedia, lookup

Transcript
ICOM 5026-090: Computer Networks
Chapter 6: The Transport Layer
By Dr Yi Qian
Department of Electronic and
Computer Engineering
Fall 2006
UPRM
Outline
•
•
•
•
•
•
The transport service
Elements of transport protocols
A simple transport protocol
The Internet transport protocol: UDP
The Internet transport protocol: TCP
Performance issues
2
UPRM
The Transport Service
•
•
•
•
Services Provided to the Upper Layers
Transport Service Primitives
Berkeley Sockets
An Example of Socket Programming:
– An Internet File Server
3
UPRM
Services Provided to the Upper Layers
• The network, transport, and application layers.
4
UPRM
Transport Service Primitives
• The primitives for a simple transport service.
5
UPRM
Frame Format
• The nesting of TPDUs, packets, and frames.
6
UPRM
A State Diagram
A state diagram for a simple connection management scheme. Transitions
labeled in italics are caused by packet arrivals. The solid lines show the client's
state sequence. The dashed lines show the server's state sequence.
7
UPRM
Berkeley Sockets
• The socket primitives for TCP.
8
UPRM
An Internet File
Server:
Client Program
9
UPRM
An Internet File
Server:
Server Program
10
UPRM
Elements of Transport Protocols
•
•
•
•
•
•
Addressing
Connection Establishment
Connection Release
Flow Control and Buffering
Multiplexing
Crash Recovery
11
UPRM
Transport Protocol
• (a) Environment of the data link layer.
• (b) Environment of the transport layer.
Point-to-point
End-to-end
Packet Storage
12
UPRM
Addressing
• TSAPs, NSAPs and transport connections
– TSAP: transport service access point
– NSAP: network service access point
13
UPRM
Addressing
• Fixed assignment
• Dynamic assignment
– Process server
– Name server
14
UPRM
Process Server
• Example: How a user process in host 1 establishes a
connection with a time-of-day server in host 2.
15
UPRM
Name Server
• Client send the request to the name server
• Name server reply the TSAP address for the
required service
• Client terminate the connection with the name
server
• Client create the connection to the server that
provide the required service
• ** In the server side, new service must
register itself with the name server
16
UPRM
Connection Establishment
• Key Problem
– Delayed duplicates may exist
– Entity may crash
• Loss memory
• Solution
– Connection ID
– Packet life time
• Restrict subnet design
• Hop counter
• Time stamp
17
UPRM
Three-way Handshake
Three protocol scenarios for establishing a connection using a three-way
handshake. CR denotes CONNECTION REQUEST.
(a) Normal operation,
(b) Old CONNECTION REQUEST appearing out of nowhere.
(c) Duplicate CONNECTION REQUEST and duplicate ACK.
18
UPRM
Connection Release
• Asymmetric
• Symmetric
19
UPRM
Connection Release
• Abrupt disconnection with loss of data.
20
UPRM
The Two-army Problem
21
UPRM
Protocol Scenarios
• (a) Normal case of a three-way handshake.
• (b) final ACK lost.
22
UPRM
Protocol Scenarios
• (c) Response lost.
• (d) Response lost and subsequent DRs lost.
6-14, c,d
23
UPRM
Flow Control and Buffering
• Flow control
– Fast transmitter and low receiver
– Difference to the flow control in DLL
• The transport layer may handle multiple connections
– Share buffering
• The transport layer shall consider the capacity of the
network
• Buffering
– Source buffering
• If the network service is not reliable
• If the network service is reliable but the destination
transport entity may drop some TPDU
24
UPRM
Buffer Management
(a)Chained fixed-size buffers.
(b)Chained variable-sized buffers.
(c)One large circular buffer per connection.
25
UPRM
Dynamic Buffer (Window) Management
• The arrows show the direction of transmission. An ellipsis (…)
indicates a lost TPDU.
26
UPRM
Dynamic Buffer (Window) Management
• Potential problem
– Loss of control packet
– Solution
• Control packets shall be sent out frequently
27
UPRM
Multiplexing
• (a) Upward multiplexing.
• (b) Downward multiplexing.
28
UPRM
Crash Recovery
• Different combinations of client and server
strategy.
29
UPRM
A Simple Transport Protocol
• Service Primitives
• Transport Entity
• Finite State Machine
30
UPRM
Service Primitives
•
•
•
•
•
connum = LISTEN(local)
connum = CONNECT(local, remote)
status = SEND(connum, buffer, bytes)
status = RECEIVE(connum, buffer, bytes)
status = DISCONNECT(connum)
31
UPRM
The Transport Entity
• Suppose that the network layer can provide
connection-oriented service
• The following network layer packets will be used
32
UPRM
States
• Each connection is in one of seven states:
– Idle – Connection not established yet.
– Waiting – CONNECT has been executed, CALL
REQUEST sent.
– Queued – A CALL REQUEST has arrived; no LISTEN
yet.
– Established – The connection has been established.
– Sending – The user is waiting for permission to
send a packet.
– Receiving – A RECEIVE has been done.
– DISCONNECTING – a DISCONNECT has been done
locally.
33
UPRM
Finite State Machine
The example protocol as a
finite state machine. Each
entry has an optional
predicate, an optional action,
and the new state. The tilde
indicates that no major action
is taken. An overbar above a
predicate indicate the negation
of the predicate. Blank entries
correspond to impossible or
invalid events.
34
UPRM
Finite State Machine
The example protocol
in graphical form.
Transitions that leave
the connection state
unchanged have been
omitted for simplicity.
35
UPRM
36
UPRM
37
UPRM
38
UPRM
39
UPRM
40
UPRM
41
UPRM
42
UPRM
43
UPRM
User Datagram Protocol
• Overview
• Remote Procedure Call (RPC)
• The Real-Time Transport Protocol
44
UPRM
Overview
•
•
•
•
•
•
•
Connectionless
Standard: RFC 768
Header: 8 bytes
The main value of UDP over IP: port address
No flow control
No error control
No retransmission
45
UPRM
The UDP Header
46
UPRM
Remote Procedure Call
• Steps in making a remote procedure call. The stubs
are shaded.
47
UPRM
The Real-Time Transport Protocol
• (a) The position of RTP in the protocol stack.
(b) Packet nesting.
48
UPRM
RTP Header
49
UPRM
Transmission Control Protocol
•
•
•
•
•
•
•
•
Overview
Connection Establishment
Connection Release
Connection Management Modeling
Transmission Policy
Congestion Control
Timer Management
Others
50
UPRM
Overview
• Standard: RFC 793, 1122, 1323
• Connection-oriented
– Full duplex
– TCP connection: Byte stream
– Provide reliable communication
• The service model
• The protocol
• The segment header
51
UPRM
Service Model
• A connection between two entities
– ID: Socket (IP and port)
• Some assigned ports
Port
21
23
25
69
79
80
110
119
52
Protocol
FTP
Telnet
SMTP
TFTP
Finger
HTTP
POP-3
NNTP
Use
File transfer
Remote login
E-mail
Trivial File Transfer Protocol
Lookup info about a user
World Wide Web
Remote e-mail access
USENET news
UPRM
Byte Stream
• (a) Four 512-byte segments sent as separate
IP datagrams.
• (b) The 2048 bytes of data delivered to the
application in a single READ CALL.
53
UPRM
The Protocol
• Every byte has a 32-bit sequence number
• The sequence number will be used in the
connection initiation and flow control
• Data unit: segment
– Header: 20 bytes plue optional parts
• Size of segment
– The payload size can be zero
– The total length of a segment < 65515 (for IP)
– The total length of a segment < MTU
• MTU=Maximum transfer unit, usually is 1500 bytes
54
UPRM
The Segment Header
55
UPRM
Flags
•
•
•
•
SYN: setup connection
ACK: acknowledgement # is valid
FIN: release connection
RST: reset connection
– Reject invalid attempts
• PSH: do not buffer the data
• URG: urgent pointer is valid
– Urgent data must be processed first
56
UPRM
Other Fields
• Window size: the number of BYTES that can be sent
after the ACK number
– The window size can be zero
• Urgent pointer: the offset to indicate the end of the
urgent data in the byte stream
• Checksum:
– When calculate the checksum, a pseudo header is included
• Optional
– Increase window size
• The maximum size in the header (16-bit) might be too small
– Utilize selective repeat instead of go back n
57
UPRM
The Pseudoheader
58
UPRM
Connection Establishment
• Three-way handshake
• The service must be available at the
destination side
– Otherwise a RST packet will be sent back
59
UPRM
Examples
• (a) TCP connection establishment in the normal case
• (b) Call collision: only one connection is established,
denoted as (x,y)
6-31
60
UPRM
Connection Release
• Symmetric
61
UPRM
Connection Management Modeling
• The states used in the TCP connection
management finite state machine.
62
UPRM
Finite State Machine
TCP connection
management finite state
machine. The heavy solid
line is the normal path for a
client. The heavy dashed
line is the normal path for a
server. The light lines are
unusual events. Each
transition is labeled by the
event causing it and the
action resulting from it,
separated by a slash.
63
UPRM
Transmission Policy
64
UPRM
Performance Issues
• In some applications, one entity may send
only one byte as the payload
– Example: a key stroke in telnet may result in a 41
byte IP packet, with only one byte information
• To improve the performance, the entity can
delay the ACK for up to 500 ms
• Nagle’s algorithm
– Buffer at the sender side
65
UPRM
Silly Window Syndrome
66
UPRM
Congestion Control
• (a) A fast network feeding a low capacity receiver.
• (b) A slow network feeding a high-capacity receiver.
67
UPRM
Control Algorithm
68
UPRM
Timer Management
• (a) Probability density of ACK arrival times in the data link layer.
• (b) Probability density of ACK arrival times for TCP.
69
UPRM
Wireless TCP and UDP
• Splitting a TCP connection into two
connections.
70
UPRM
Transitional TCP
• (a) RPC using normal TPC.
• (b) RPC using T/TCP.
71
UPRM
Performance Issues
•
•
•
•
•
Performance Problems in Computer Networks
Network Performance Measurement
System Design for Better Performance
Fast TPDU Processing
Protocols for Gigabit Networks
72
UPRM
Performance Problems
• The state of transmitting one megabit from San Diego to Boston
• (a) At t = 0, (b) After 500 μsec, (c) After 20 msec, (d) after 40
msec.
73
UPRM
Network Performance Measurement
• The basic loop for improving network
performance
– Measure relevant network parameters
– Try to understand what is going on
– Change one parameter
74
UPRM
System Design for Better Performance
• Rules:
–
–
–
–
–
–
CPU speed is more important than network speed
Reduce packet count to reduce software overhead
Minimize context switches
Minimize copying
You can buy more bandwidth but not lower delay
Avoiding congestion is better than recovering from
it
– Avoid timeouts
75
UPRM
System Design for Better Performance
• Response as a function of load.
76
UPRM
System Design for Better Performance
• Four context switches to handle one packet
• with a user-space network manager.
77
UPRM
Fast TPDU Processing
• The fast path from sender to receiver is shown with a
heavy line.
• The processing steps on this path are shaded.
78
UPRM
Fast TPDU Processing
• (a) TCP header
• (b) IP header
• In both cases, the shaded fields are taken from the prototype
without change
79
UPRM
Fast TPDU Processing
• A timing wheel.
80
UPRM
Protocols for Gigabit Networks
•
Time to transfer and acknowledge a 1-megabit file over a 4000-km line.
81
UPRM