Title: Transport Layer
1Transport Layer
- Rong Wang
- CGS3285
- Spring2004
2TCP RELIABLE TRANSPORT SERVICES
- Internet Protocol (IP) provides unreliable
datagram service'' between hosts - Transport protocols provide end-to-end delivery
between endpoints of a connection e.g.,
processes or programs - User Datagram Protocol (UDP) provides datagram
service - Transmission Control Protocol (TCP) provides
reliable data delivery
3USER DATAGRAM PROTOCOL
- UDP delivers independent messages, called
datagrams between applications or processes on
host computers - Best effort'' delivery - datagrams may be lost,
delivered out of order, etc. - Checksum (optionally) guarantees integrity of
data - For generality, endpoints of UDP are called
protocol ports or ports - Each UDP data transmission identifies the
internet address and port number of the
destination and the source of the message - Destination port and source port may be different
4UDP HEADERS
- UDP datagrams have a header that follows the
hardware and IP headers - Hardware IP UDP Application Data
- UDP header is very simple
- Port numbers
- Message length
- Checksum
- UDP source port UDP destination port UDP message
length UDP checksum Data
Hardware IP UDP Application Data
UDP Source Port UDP Destination Port
UDP Message Length UDP Checksum
Data Data
5TCP
- Transmission Control Protocol (TCP) is most
widely used transport protocol - Provides reliable data delivery by using IP
unreliable datagram delivery - Compensates for loss, delay, duplication and
similar problems in Internet components - Reliable delivery is high-level, familiar model
for construction of applications
6FEATURES OF TCP
- Connection oriented Application requests
connection to destination and then uses
connection to deliver data to transfer data - Point-to-point A TCP connection has two
endpoints - Reliability TCP guarantees data will be
delivered without loss, duplication or
transmission errors - Full duplex The endpoints of a TCP connection
can exchange data in both directions
simultaneously - Stream interface Application delivers data to
TCP as a continuous stream, with no record
boundaries TCP makes no guarantees that data
will be received in same blocks as transmitted - Reliable connection startup Three-way handshake
guarantees reliable, synchronized startup between
endpoints - Graceful connection shutdown TCP guarantees
delivery of all data after endpoint shutdown by
application
7STREAM DELIVERY
8USING IP FOR DATA DELIVERY
- TCP uses IP for data delivery (like UDP)
- Endpoints are identified by ports (like UDP)
- Allows multiple connections on each host
- Ports may be associated with an application or a
process - IP treats TCP like data and does not interpret
any contents of the TCP message
9SENDING AND RECEIVING BUFFERS
10TCP SEGMENTS
11Note
The bytes of data being transferred in each
connection are numbered by TCP. The numbering
starts with a randomly generated number.
12Note
The value of the sequence number field in a
segment defines the number of the first data byte
contained in that segment.
13Note
The value of the acknowledgment field in a
segment defines the number of the next byte a
party expects to receive. The acknowledgment
number is cumulative.
14TCP SEGMENT FORMAT
15CONTROL FIELD
16DESCRIPTION OF FLAGS IN THE CONTROL FIELD
Flag Description
URG The value of the urgent pointer field is valid.
ACK The value of the acknowledgment field is valid.
PSH Push the data.
RST The connection must be reset.
SYN Synchronize sequence numbers during connection.
FIN Terminate the connection.
17THREE-STEP CONNECTION ESTABLISHMENT
18FOUR-STEP CONNECTION TERMINATION
19States for TCP
State Description
CLOSED There is no connection.
LISTEN The server is waiting for calls from the client.
SYN-SENT A connection request is sent waiting for acknowledgment.
SYN-RCVD A connection request is received.
ESTABLISHED Connection is established.
FIN-WAIT-1 The application has requested the closing of the connection.
FIN-WAIT-2 The other side has accepted the closing of the connection.
TIME-WAIT Waiting for retransmitted segments to die.
CLOSE-WAIT The server is waiting for the application to close.
LAST-ACK The server is waiting for the last acknowledgment.
20STATE TRANSITION DIAGRAM
21Note
A sliding window is used to make transmission
more efficient as well as to control the flow of
data so that the destination does not become
overwhelmed with data. TCPs sliding windows are
byte-oriented.
22 SENDER BUFFER
23RECEIVER WINDOW
24SENDER BUFFER AND SENDER WINDOW
25SLIDING THE SENDER WINDOW
26EXPANDING THE SENDER WINDOW
27SHRINKING THE SENDER WINDOW
28Note
In TCP, the sender window size is totally
controlled by the receiver window value (the
number of empty locations in the receiver
buffer). However, the actual window size can be
smaller if there is congestion in the network.
29Note
Some points about TCPs sliding windows
The source does not have to send a full windows
worth of data.
The size of the window can be increased or
decreased by the destination.
The destination can send an acknowledgment at
any time.
30LOST SEGMENT
31LOST ACKNOWLEDGEMENT
32TCP TIMERS