8/7/2019 Computer Networks UNIT-9
1/26
C o n f i d e n t i a l
Course : BCA
Semester : IV
Subject Code : BC 0048
Subject Name : Computer Networks
Unit number : 9
Unit Title : Transport Layer
HOME NEXT
8/7/2019 Computer Networks UNIT-9
2/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Transport Layer
Objectives
After going through the presentation, you should be able to:
Describe The services of Transport layer
Discuss Connection establishment and connection rellease
Discuss Transport Protocols
Explain User datagram protocol
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
3/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Lecture outline
Introduction
Services of Transport layer
Connection establishment
Connection Release
Transport Protocols
Summary
Transport Layer
NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
4/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Introduction
The transport layer is the fourth layer of the OSI reference model.
The transport layer provides transparent transfer of data between
hosts.
It is usually responsible for end-to-end connection, error recovery, flow
control, and ensuring complete data transfer.
The transport service is said to perform "peer to peer" communication,
with the remote (peer) transport entity.
The purpose of the Transport layer is to provide transparent transfer of
data between end users, thus relieving the upper layers from any
concern with providing reliable and cost-effective data transfer.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
5/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Services of Transport layer
The transport layer usually turns the unreliable and very basic
service provided by the Network layer into a more powerful one.
There is a long list of services that can be optionally provided at
this level.
Connection-oriented :
This is normally easier to deal with than connection-less models, so
where the Network layer only provides a connection-less service, often
a connection-oriented service is built on top of that in the Transport
layer.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
6/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Services of Transport layer
Same Order Delivery :
The Network layer doesn't generally guarantee that packets of data will
arrive in the same order that they were sent, but often this is a desirable
feature, so the Transport layer provides it.
Reliable Data :
By introducing segment numbering in the transport layer packet headers,
the packets can be sorted in order. Of course, error free is impossible,
but it is possible to substantially reduce the numbers of undetected
errors.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
7/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Services of Transport layer
Flow Control :
When sender is fast and receiver is slow, flow control mechanism is used
to stop sender from fast sending so that receiver should accept all the
data properly.
Congestion avoidance :
Network congestion occurs when a queue buffer of a network node is full
and starts to drop packets. Automatic repeat request may keep the
network in a congested state. This situation can be avoided by adding
congestion avoidance to the flow control, including slow-start.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
8/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Services of Transport layer
Byte orientation :
Rather than dealing with things on a packet-by-packet basis, the
Transport layer may add the ability to view communication just as a
stream of bytes. This is nicer to deal with than random packet sizes.
Ports :
Ports are essentially ways to address multiple entities in the same
location. TCP is the more complicated, providing a connection and byte
oriented stream which is almost error free, with flow control, multipleports, and same order delivery. UDP is a very simple 'datagram' service,
which provides limited error reduction and multiple ports.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
9/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Connection establishment
Establishing a connection sounds easy but in practice it is not so.
The problem occurs when the network can lose, store and duplicate
packets.
The Major problem is the existence of delayed duplicates. It can be
solved in various ways but not of them work satisfactorily.
Packet lifetime can be restricted to a known maximum using one of the
following ways.
Restricted subnet design
Putting a hop counter in each packet
Time stamping each packet.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
10/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Connection establishment
(a) Normal Operation : b) Old Duplicate connection request
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
11/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Connection establishment
(c) Duplicate connection request and duplicate Ack.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
12/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Connection release
Releasing a connection is easier than establishing the connection.
There are two styles of terminating/releasing a connection. They are:
Symmetric release
Asymmetric release
Asymmetric release is the way the telephone system works. Here when
one party hangs up, the connection is broken. Asymmetric release is
abrupt and may result in data loss.
Symmetric release treats the connection as two separate unidirectional
connections and requires each one to be released separately.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
13/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Connection release
a) Figure below shows the normal case in which one of the users sends a
DISCONNECTION REQUEST (DR) TPDU. When it arrives, the recipient
sends back a DR TPDU and starts the timer to keep track in case DR
is lost. Finally when the ACK TPDU arrives the receiver also releases
the connection.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
14/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Connection release
(b) Figure below illustrates the situation when the signal ACK TPDU whichwe came across in normal connection release is lost. The situation is
saved by the use of timer. When the timer expires, the connection is
released anyway.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
15/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Connection release
(c) Figure below illustrates the case when the second DR TPDU which
we came across in normal connection release is lost. The user
initiating the disconnection will not receive the expected response,
with time out and will start all over again. Here we assume the
second time no TPDU are lost and all TPDUs delivered correctly and
on time.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
16/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Transport Layer Protocols
TCP protocol :
The Transmission Control Protocol (TCP) is one of the core protocols of
the Internet protocol suite, often simply referred to as TCP/IP. Using TCP,
applications on networked hosts can create connections to one another,over which they can exchange streams of data using Stream Sockets.
The protocol guarantees reliable and in-order delivery of data from
sender to receiver.
TCP supports many of the Internet's most popular application protocols
and resulting applications, including the World Wide Web, e-mail, File
Transfer Protocol and Secure Shell.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
17/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Transport Layer Protocols
TCP protocol : ( Continued..)
In the Internet protocol suite, TCP is the intermediate layer between the
Internet Protocol (IP) below it, and an application above it.
Applications often need reliable pipe-like connections to each other,
whereas the Internet Protocol does not provide such streams, but rather
only best effort delivery (i.e., unreliable packets).
TCP does the task of the transport layer in the simplified OSI model of
computer networks.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
18/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Transport Layer Protocols
TCP segment structure :
A TCP segment consists of two sections: header and data.
The header consists of 11 fields, of which only 10 are required.
The eleventh field is optional and named: options.
HOME NEXTPREVIOUS
+Bits
0347 815 1631
0 Source Port Destination Port
32 Sequence Number
64 Acknowledgment Number
96Data
OffsetReserved Flags Window
128 Checksum Urgent Pointer
160 Options (optional)
160/192+
Data
8/7/2019 Computer Networks UNIT-9
19/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Transport Layer Protocols
TCP segment structure : ( continued..)
Source port: This field identifies the sending port.
Destination port: This field identifies the receiving port.
Sequence number: The sequence number has a dual role. If the
SYN flag is present then this is the initial sequence number and the
first data byte is the sequence number plus 1. Otherwise if the SYN
flag is not present then the first data byte is the sequence number.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
20/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Transport Layer Protocols
TCP segment structure : ( continued..)
Acknowledgement number: If the ACK flag is set then the value
of this field is the sequence number that the sender of the
acknowledgement expects next.
Data offset: This 4-bit field specifies the size of the TCP header in
32-bit words. The minimum size header is 5 words and the
maximum is 15 words thus giving the minimum size of 20 bytes and
maximum of 60 bytes. This field gets its name from the fact that it is
also the offset from the start of the TCP packet to the data.
Reserved: 4-bit reserved field for future use and should be set to
zero.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
21/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Transport Layer Protocols
TCP segment structure : ( continued..)
Flags (Control bits): This field contains 8 bit flags:
CWR: Congestion Window Reduced (CWR) flag is set by the sending
host to indicate that it received a TCP segment with the ECE flag set
ECE: ECN-Echo flag. Used to indicate that the tcp peer is ECN
capable during 3-way handshake
URG: Urgent pointer field is significant
ACK: Acknowledgement field is significant
PSH: Push function
RST: Reset the connection
SYN : Synchronize sequence numbers
FIN: No more data from sender
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
22/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Transport Layer Protocols
TCP segment structure : ( continued..)
Window: The number of bytes the sender is willing to receive starting
from the acknowledgement field value
Checksum: The 16-bit checksum field is used for error-checking of the
header and data.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
23/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Transport Layer Protocols
UDP protocol :
User Datagram Protocol (UDP) is one of the core protocols of the Internet
protocol suite. Using UDP, programs on networked computers can send
short messages sometimes known as datagrams (using Datagram
Sockets) to one another.
UDP does not guarantee reliability or ordering in the way that TCP does.
Datagrams may arrive out of order, appear duplicated, or go missing
without notice.
UDP is a minimal message-oriented transport layer protocol. In the
Internet protocol suite, UDP provides a very simple interface between a
network layer below and a session layer or application layer above.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
24/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Transport Layer Protocols
UDP header format :
The UDP header consists of only 4 fields. The use of two of those is
optional.
HOME NEXTPREVIOUS
+ Bits 0 - 15 16 - 31
0 Source Port Destination Port
32 Length Checksum
64 Data
8/7/2019 Computer Networks UNIT-9
25/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Transport Layer Protocols
UDP header format : ( continued)
Source port :This field identifies the sending port when meaningful and
should be assumed to be the port to reply to if needed. If not used, then
it should be zero.
Destination port :This field identifies the destination port and is
required.
Length : A 16-bit field that specifies the length in bytes of the entire
datagram: header and data. The minimum length is 8 bytes since that's
the length of the header. The field size sets a theoretical limit of 65,527
bytes for the data carried by a single UDP datagram.
Checksum :The 16-bit checksum field is used for error-checking of
the header and data.
HOME NEXTPREVIOUS
8/7/2019 Computer Networks UNIT-9
26/26
C o n f i d e n t i a l
Unit-9 Transport Layer
Summary
The transport layer is the fourth layer of the OSI reference model.
The transport layer provides transparent transfer of data between
hosts. It is usually responsible for end-to-end connection, error
recovery, flow control, and ensuring complete data transfer.
The transport layer provides various services.
The most important of which is to provide an end to end, reliable
connection oriented byte stream from sender to receiver. It is
achieved by using the service primitives like LISTEN, SEND etc.
These service primitives permit the connection establishment, use
and release of the connection. Two main important protocols of transport layer are TCP and UDP.
TCP is reliable and connection oriented protocol where as UDP is
unreliable and connection less protocol.
HOMEPREVIOUS