Title: IS 3'4 Transport layer
1IS 3.4Transport layer
Application Layer
Session Layer
Transport Layer
Network Layer
Data Link
Physical Layer
M.H. Rahman
2Outline
- Introduction
- Services provided
- Protocols
- Performance
- Summary
3Introduction
- Transport layer is the heart of the whole
protocol hierarchy. - Goal provide efficient, reliable and
cost-effective service to its users (processes in
the application layer) - Makes use of the services provided by the network
layer - The transport protocol permits the exchange of
TPDU between transport entities - transport entity hardware and/or software within
the transport layer that does the work.
4Logical relationship
5Transport Layer role
- Transport layer services are very similar to
network services - connection-oriented service
- 3 phases establishment, data transfer, release
- connectionless
- Why do we need the transport layer?
- network layer is part of the Communication subnet
- makes it possible for transport service to be
more reliable than the underlying network
services - makes it possible to have transport service
primitives independent of the network service
primitives - enhance QoS (Quality of Service)
6Transport Service Primitives
7Elements of Transport Protocols (1)
- Addressing
- TSAP (Transport Service Access Point)
- There is a unique port number for a given service
- Establishing a connection
- problem is delayed duplicates
- solved by imposing a finite lifetime for packets
- 3-way handshake used to agree on the initial
sequence number - Releasing a connection
- need to avoid loss of data
- two-army problem (how both sides can be
convinced?)
8Elements of Transport Protocols (2)
- Flow control buffering
- management of connections while they are in use
- buffer space and carrying capacity of the subnet
will limit data rate - Multiplexing
- upward many applications use the same connection
- downward one application uses multiple
connections - Crash recovery
- can a client continue working over an open
connection when a server crashes and then quickly
reboot?
9Internet Transport Protocol
- There are two transport control protocol in the
TCP/IP protocol suite - TCP (Transport Control Protocol)
- This is a connection oriented service and is most
widely used for most of the internet
transactions. - UDP (User Datagram Protocol)
- This is a connectionless service within the
framework of TCP/IP protocol suite.
10UDP
- UDP is specified in RFC 768.
- It provides a connectionless service to an
application. - Basically provides an unreliable service and is
used when reliability is not critical and time
lost due to connection and set up and release is
not justifiable - Examples
- Inward data collection from sensors etc.
- Outward data dissemination including broadcast
messages. - Request response. Application when transaction
service is provided by c common server. - Real time application such as telemetry.
- Voice over IP
11UDP
- UDP header
- Length Length of entire UDP segment, including
header and data. - Checksum Similar to TCP checksum and applied to
entire segment plus a pseudo header, used for
calculation of checksum.
0
16
31
Destination Port
Source Port
Length
Checksum
12TCP
- TCP is designed to provide reliable communication
between a pair of processes (TCP users) across a
variety of reliable and unreliable networks. - It provides a connection oriented full-duplex
stream transport service that allows two
application programs to establish a connection
and then transfer data between them. - Each connection is terminated gracefully after
data have been transferred.
13TCP
Source Port
Destination Port
Sequence number
Acknowledgement number
Data offset
Window
Flags
Reserved
Urgent Pointer
Checksum
Option and padding
U A P R S F R C S S Y I G K H T N N
Flags
14TCP Header format
- Definitions
- Source Port (16 bits) source TCP user.
- Destination Port (16 bit) Destination TCP user
- Sequence Number (32 buts)
- Sequence number of the first data octets in the
segment except when the SYN flag is set, it is
the initial sequence number (ISN). Sequence
number of of data octet is ISN1. - Acknowledgement Number (32 bits)
- A piggyback acknowledgement. Contains the
sequence number of the next data octet the TCP is
expecting. - Reserved (6 bits) Reserved for future use.
15TCP Header format
- Definitions (contd.)
- Flags
- URG urgent pointer field significant.
- ACK acknowledge field significant.
- PSH push function
- RST rest connection
- SYN synchronize sequence number.
- FIN no more data, this is the last one.
- Window (16 bits)
- flow control credit allocation in octets.
Contains the number of data octets, beginning
with the sequence number in the ack filed that
the sender is willing to accept.
16TCP Header format
- Definitions (contd.)
- Checksum (16 bits)
- the ones complement of the sum modulo 216 - 1 of
all the 16 bit words in the segment plus a pseudo
header. The pseudo header includes source and
destination address and protocol plus a segment
length field. - Urgent Pointer (16 bits)
- points to the last octet in the sequence of
urgent data. - Options (variable)
- an example is the option that specifies the
maximum segment size that will be accepted.
17TCP Mechanism
- TCP mechanism has three phases
- Connection establishment
- data transfer and
- connection termination
18TCP Mechanism
- Connection Establishment
- TCP always uses three way handshake.
- To initiate a connection, an entity sends a SYN,
SNX (ISN). - The receiver responds with SYN, SNY (ISN) and AN
X1. - Finally the initiator responds with ANY1
19Establishing a connection (a)
Host1
Host2
Normal Operation
CR (seq x)
ACK (seq y, ACK x)
CR connection request ACK request accepted
DATA (seq x, ACK y)
20Establishing a connection (b)
Host1
Host2
Old CR duplicate appearing out of nowhere
CR (seq x)
ACK (seq y, ACK x)
REJECT (ACK y)
21Establishing a connection (c)
Host1
Host2
Old CR duplicate and ACK appearing out of nowhere
CR (seq x)
ACK (seq y, ACK x)
DATA (seq x, ACK z)
REJECT (ACK y)
22TCP Mechanism
- Data Transfer
- The TCP layer transfer a block of data to the IP
layer for transport to a remote location. In most
cases, a sliding window mechanism, similar to the
one discussed at DLL, is used. - Data transfer can be either block oriented or
stream oriented. This refers to how the window is
designated number of blocks or number of bytes. - If the data transfer is block oriented, then the
window size indicates number of blocks of data
(packets). - If the data transfer is stream oriented, then the
window size indicates number of bytes of data.
23TCP Mechanism
- Data Transfer
- Data transfer is viewed logically as a stream of
octets. Each segment contains sequence number of
the first octet of the segment. - Flow control is exercised using a credit
allocation scheme in which the credit number is
in octet rather than number of segments (as in
X.25). - Data is buffered by both the sender and receiver
before delivery to the application. TCP passes
data to its application at its discretion (when
to deliver). However the sender can use PSH and
URG pointer to force the TCP to deliver the data.
24TCP Mechanism
Events at Host 1
Events at Host 2
Send packet 1
Receive packet 1
Send ack 1
Receive ack1 Send packet 2
On TCP communication, octet number , instead of
packet number is used.
packet lost
Time out expires Send packet 2
packet 2 received Send ack 2
25TCP Mechanism
- Connection termination
- Each TCP user must issue a CLOSE primitive to
request termination of its connection. - The transport entity sets the FIN bit on the last
segment of data and sends it out. - Abrupt termination can occur if an ABORT
primitive is issued by the user.
26Releasing a connection (a)
Host1
Host2
Normal operation
Send DR start timer
DR
Send DR start timer
DR
Release connection
Send ACK
ACK
Release connection
DR disconnect request ACK request accepted
27Releasing a connection (b)
Host1
Host2
Final ACK lost
Send DR start timer
DR
Send DR start timer
DR
Release connection
Send ACK
ACK
(Timeout) Release connection
28Releasing a connection (c)
Host1
Host2
Response lost
Send DR start timer
DR
Send DR start timer
DR
(Timeout) Send DR start timer
DR
Send DR start timer
DR
Release connection
ACK
Send ACK
(Timeout) Release connection
29TCP Implementation
- The TCP standard provides a precise definition of
the protocol to be used between TCP entities.
However, certain aspects of the protocol admit
several possible implementation options. - Send policy
- In the absence of PSH and close termination
window, a sending TCP entity is free to transmit
data at its own convenience. The actual policy
will depend on performance considerations. - Deliver policy
- In the absence of push, a receiving TCP entity is
free to deliver data to the user at its
convenience. The actual policy will depend on
performance considerations.
30TCP Implementation
- Accept policy
- When all data segments arrive in order over a
TCP, TCP places data in a receive buffer for
delivery tot he user. In case they are out of
order the receiving TCP has two options - In-order accept segments arriving in order only.
Discard if not. - In-window accept all segment within the receive
window, even if they are out of order. - Retransmit policy
- TCP maintains a queue of segments that have been
sent out but not yet acknowledged. TCP
specification states that TCP will retransmit if
it fails to receive an acknowledgement within a
certain time. There are variation on how to
handle the timer.
31TCP Implementation
- Acknowledge policy
- When a data segment arrives in sequence, the
receiving TCP entity has two options concerning
the timing of acknowledgement - Immediate When data is accepted, immediately
transmit an empty data segment with the
acknowledgement. - Cumulative When data are accepted, record the
need for acknowledgement but wait for an outbound
segment with data I which to piggyback the
acknowledgement. To avoid long delay, set a
window timer.
32TCP Congestion Control
- The credit based flow control mechanism was
designed to enable a destination to restrict flow
of segments from source to avoid buffer overflow
at the receiver. The same flow control mechanism
is now used to provide congestion control. It is
done with two parameters - Retransmission timer management. The retransmit
time is based on the anticipated delay of the
response. If the network is heavily loaded, RTT
is increased. There are a variety of ways to
calculate this time. - Window management. The size of the window can be
dynamically adjusted to suit the needs of the
network. Again, there are a variety of mechanism
for doing this.
33Summary - TCP
- W have provided a very brief description of how
the TCP within the TCP/IP protocol suite works.
For details on some of the items you may refer
to - Data and Computer Communications (6th edition),
by William Stalling, Prentice Hall, 2000. - Computer Networks and Internet, by Douglas E
Comer, Prentice Hall, 1997