Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
12 views

Module-4-TransportLayer

Uploaded by

Safa Hamza
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Module-4-TransportLayer

Uploaded by

Safa Hamza
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 81

Module 4

The Transport Layer


OSI vs TCP/IP
Connection-Oriented Service

A’s table C’s Table E’s


Table
The Transport Service
a) Services Provided to the Upper Layers
b) Transport Service Primitives
a) Network layer + Transport layer is the heart of
the protocol hierarchy
b) The network layer provides end-to-end packet
delivery using data grams or virtual circuits.
c) The transport layer builds on the networks
layer to provide data transport from process
on a source machine to a process on a
destination machine with desired level of
reliability that is independent of the physical
networks currently in use.
a) The ultimate goal of the transport layer is to
provide efficient, reliable and cost effective
transmission service to its users normally
processes in the application layer.
b) To achieve this transport layer makes use of
the services provided by the network layer.
c) Software / or hardware with in the transport
layer that does the work is called transport
entity.
d) It can be located in os kernel, package
bounded in to network application, NIC etc
a) There are two types of network service, connection-
oriented and connectionless, there are also two
types of transport service.
b) The connection-oriented transport service is similar
to the connection-oriented network service in many
ways. In both cases, connections have three phases:
establishment, data transfer, and release.
Addressing and flow control are also similar in both
layers.
c) Furthermore, the connectionless transport service is
also very similar to the connectionless network
service. However, note that it can be difficult to
provide a connectionless transport service on top of
a connection-oriented network service,
DIFFERENCE BETWEEN NETWORK AND TRANSPORT
LAYER
a) The transport code runs entirely on the users’
machines, but the network layer mostly runs on the
routers, (at least for a wide area network).
b) The users have no real control over the network
layer, so they cannot solve the problem of poor
service by using better routers or putting more error
handling in the data link layer because they don’t
own the routers.
c) The only possibility is to put on top of the network
layer another layer that improves the quality of the
service.
a) If, in a connectionless network, packets are lost or
distorted, the transport entity can detect the problem
and compensate for it by using retransmissions.
b) If, in a connection-oriented network, a transport
entity is informed halfway through a long
transmission that its network connection has been
unexpectedly terminated, with no indication of what
has happened to the data currently in transit, it can
set up a new network connection to the remote
transport entity
a)Thanks to the transport layer, application
programmers can write code according to a standard
set of primitives and have these programs work on a
wide variety of networks, without having to worry
about dealing with different network interfaces and
levels of reliability.
b) If all real networks were flawless and all had the
same service primitives and were guaranteed never,
ever to change, the transport layer might not be
needed.
c) However, in the real world it fulfills the key
function of isolating the upper layers from the
technology, design, and imperfections of the network.
a) The bottom four layers can be seen as the transport
service provider, whereas the upper layer(s) are
the transport service user. This distinction of
provider versus user has a considerable impact on
the design of the layers and puts the transport layer
in a key position.
Why the transport layer ?
1. The network layer exists on end hosts and
routers in the network. The end-user cannot
control what is in the network. So the end-user
establishes another layer, only at end hosts, to
provide a transport service that is more reliable
than the underlying network service.

2. While the network layer deals with only a few


transport entities, the transport layer allows
several concurrent applications to use the
transport service.

3
3. It provides a common interface to application
writers, regardless of the underlying network
layer. In essence, an application writer can write
code once using the transport layer primitive and
use it on different networks (but with the same
transport layer).
TL are also have two type of network service,
connection-oriented and connection less.
On both cases it have three phases establishment
data transfer and release.
Addressing and flow control are also similar in
both layers.
It is difficult to provide a connection less
transport service on the top of connection
oriented network layer.
Why are there two distinct layer?
a) The TL code runs entirely on the users
machines but the network layer mostly runs
on the routers which are operated by the
carrier.
b) What happen if it frequently loses packets?
Crash? Inadequate service?
c) The users have no real control over the
network layer so they can not solve the
problem of poor service by using better
routers or putting more error handling in the
data link layer because they do not own the
a) The only possibility is to put on the top of the
network layer another layer that improves the
quality of the service.
b) In connection less network packet are lost. The
transport entity can detect the problem and
compensate for it by using retransmission.
c) In connection oriented network it can set up new
connection , it peer asking which data arrived and
which did not later it can pick up from where it left
off.
d) The existence of the TL makes it possible for the T
service to be more reliable than the underlying
network
a) Application programmers can write code according
to a standard set of primitives .
b) It can work on wide variety of networks.
c) In real world TL isolating the upper layers from the
technology design and imperfections of the
network.
d) The bottom layer are called transport service
provider and upper layers are the transport service
user .
e) TL is in a key position. It is the boundary between
provider and user.
The purpose of TL to provide a reliable
service on top of an un reliable network
a) Main difference
b) 1. the network service is intended to model the
service offered by real networks. Generally un
reliable.
c) 2. whom the service are intended for? many users
or programmers ever see bare network service.
Many see the TL primitives. TL service must be
convenient and easy to use. (NL is not visible for
users but TL)
Elements of Transport Protocols

a) Addressing
b) Connection Establishment
c) Connection Release
d) Flow Control and Buffering
e) Multiplexing
f) Crash Recovery
Addressing
a) When an application process wishes to set up a
connection to a remote application process it must
specify which one to connect to
b) In the Internet endpoints are called ports.
c) Specific endpoint in the transport layer is TSAP
Transport Service Access Point.
d) End point in network is NSAP Network Service
Access Point
e) IP addresses are examples.
Addressing

TSAPs (Transport Service Access Point) , NSAPs (Network SAP).

TCP calls TSAP s ... ports


ATM calls TSAPs ... AAL-SAP
Addressing
A possible scenario for a transport connection is
as follows.
1. A time of day server process on host 2 attaches itself
to TSAP 1522 to wait for an incoming call. How a
process attaches itself to a TSAP is outside the
networking model and depends entirely on the local
operating system.
2. An application process on host 1 wants to find out
the time-of-day, so it issues a CONNECT request
specifying TSAP 1208 as the source and TSAP 1522
as the destination. This action ultimately results in a
transport connection being established between the
application process on host 1 and server 1 on host 2.
Addressing
3. The application process then sends over a request for
the time.
4. The time server process responds with the current
time.
5. The transport connection is then released .
How does the user process on host 1 know that the
mail server is attached to TSAP 1522?
Connection Establishment

a) Establishing a connection sounds easy, but it is


actually surprisingly tricky.
b) it would seem sufficient for one transport entity to
just send a CONNECTION REQUEST to the
destination and wait for a CONNECTION
ACCEPTED reply. The problem occurs when the
network can lose, store, and duplicate packets. This
behavior causes serious complications.
a) Imagine a subnet that is so congested that
acknowledgements hardly ever get back in time and
each packet times out and is retransmitted two or
three times. Suppose that the subnet uses datagrams
inside and that every packet follows a different
route.
b) Some of the packets might get stuck in a traffic jam
inside the subnet and take a long time to arrive, that
is, they are stored in the subnet and pop out much la
c) ter.
d) Example Bank case
Three –way handshaking Signal
a) Connections are established by having host 1 send a
CONNECTION REQUEST TPDU (transport
Protocol Data Unit) containing the proposed initial
sequence number and destination port number to a
remote peer, host 2.
b) The receiver, host 2, then acknowledges this request
by sending a CONNECTION ACCEPTED TPDU
back. If the CONNECTION REQUEST TPDU is
lost but a delayed duplicate CONNECTION
REQUEST suddenly shows up at host 2, the
connection will be established incorrectly.
a)To solve this problem, Tomlinson (1975)
introduced the three-way handshake.
b)This establishment protocol does not require
both sides to begin sending with the same
sequence number, so it can be used with
synchronization methods.
c)This protocol involves one peer checking
with the other that the connection request is
indeed current.
d)The normal setup procedure when host 1
initiates is shown in Fig.
a)Host 1 chooses a sequence number, x, and
sends a CONNECTION REQUEST TPDU
transport protocol data unit containing it to
host 2. Host 2 replies with an ACK TPDU
acknowledging x and announcing its own initial
sequence number, y. Finally, host 1
acknowledges host 2's choice of an initial
sequence number in the first data TPDU that it
sends.
Connection Establishment (2)

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.
a) Now let us see how the three-way handshake works
in the presence of delayed duplicate control
TPDUs. In Fig. (b), the first TPDU is a delayed
duplicate CONNECTION REQUEST from an old
connection. This TPDU arrives at host 2 without
host 1's knowledge. Host 2 reacts to this TPDU by
sending host 1 an ACK TPDU, in effect asking for
verification that host 1 was indeed trying to set up a
new connection. When host 1 rejects host 2's
attempt to establish a connection, host 2 realizes
that it was tricked by a delayed duplicate and
abandons the connection. In this way, a delayed
duplicate does no damage.
Worst case
a) The worst case is when both a delayed
CONNECTION REQUEST and an ACK are
floating around in the subnet. This case is shown in
Fig. (c). As in the previous example, host 2 gets a
delayed CONNECTION REQUEST and replies to
it.
a) At this point it is crucial to realize that host 2 has
proposed using y as the initial sequence number for
host 2 to host 1 traffic, knowing full well that no
TPDUs containing sequence number y or
acknowledgements to y are still in existence. When
the second delayed TPDU arrives at host 2, the fact
that z has been acknowledged rather than y tells
host 2 that this, too, is an old duplicate. The
important thing to realize here is that there is no
combination of old TPDUs that can cause the
protocol to fail and have a connection set up by
accident when no one wants it.
Connection Release
a) Releasing a connection is easier than establishing
one. Nevertheless, there are more pitfalls than one
might expect.
b) There are two styles of terminating a connection:
asymmetric release and symmetric release
c) Asymmetric release is the way the telephone system
works: when one party hangs up, the connection is
broken.
d) Symmetric release treats the connection as two
separate unidirectional connections and requires
each one to be released separately.
a) Asymmetric release is unexpected and may result in
data loss. Consider the scenario of Fig below. After
the connection is established, host 1 sends a TPDU
(Transport Protocol Data Unit/ Segment) that
arrives properly at host 2.
b) Then host 1 sends another TPDU. Unfortunately,
host 2 issues a DISCONNECT before the second
TPDU arrives. The result is that the connection is
released and data are lost.
Connection Release

Abrupt disconnection with loss of data.


Connection Release (3)

6-14, a, b

Four protocol scenarios for releasing a connection. (a) Normal case of a


three-way handshake. (b) final ACK lost.
a) Figure 14. Four protocol scenarios for
releasing a connection. (a) Normal case of
three-way handshake. (b) Final ACK lost. (c)
Response lost. (d) Response lost and
subsequent DRs lost.
a).In Fig. 14(a), we see the normal case in which one of
the users sends a DR (DISCONNECTION REQUEST)
TPDU to initiate the connection release. When it
arrives, the recipient sends back a DR TPDU, too, and
starts a timer, just in case its DR is lost. When this DR
arrives, the original sender sends back an ACK TPDU
and releases the connection.
a) Finally, when the ACK TPDU arrives, the receiver
also releases the connection. Releasing a connection
means that the transport entity removes the
information about the connection from its table of
currently open connections.
a) If the final ACK TPDU is lost, as shown in
Fig. 14(b), the situation is saved by the timer.
When the timer expires, the connection is
released anyway.
a) Now consider the case of the second DR being lost.
The user initiating the disconnection will not
receive the expected response, will time out, and
will start all over again. In Fig. 14(c) we see how
this works, assuming that the second time no
TPDUs are lost and all TPDUs are delivered
correctly and on time.
a) Our last scenario, Fig. 14(d), is the same as
Fig. 14(c) except that now we assume all the
repeated attempts to retransmit the DR also
fail due to lost TPDUs. After N retries, the
sender just gives up and releases the
connection. Meanwhile, the receiver times out
and also exits.
Connection Release (4)

6-14, c,d

(c) Response lost. (d) Response lost and subsequent DRs lost.
User Datagram Protocol (UDP)
a) The User Datagram Protocol (UDP) is one of
the core members of the Internet Protocol
suite, the set of network protocols used for the
Internet.
b) With UDP, computer applications can send
messages, in this case referred to as datagram,
to other hosts on an Internet Protocol (IP)
network without requiring prior
communications to set up special transmission
channels or data paths.
c) UDP uses a simple transmission model with a
minimum of protocol mechanism.
a) It has no handshaking dialogues, and thus
exposes any unreliability of the underlying
network protocol to the user's program.
b) This is normally IP over unreliable media,
there is no guarantee of delivery, ordering or
duplicate protection.
c) UDP provides checksums for data integrity,
and port numbers for addressing different
functions at the source and destination of the
datagram.
a) UDP is suitable for purposes where error
checking and correction is either not
necessary or performed in the application,
avoiding the overhead of such processing at
the network interface level.
b) Time-sensitive applications often use UDP
because dropping packets is preferable to
waiting for delayed packets, which may not be
an option in a real-time system.
a) Many of the Internet applications use UDP,
including: the Domain Name System, where
queries must be fast and only consist of a
single request followed by a single reply
packet, the Simple Network Management
Protocol (SNMP), the Routing Information
Protocol (RIP) and the Dynamic Host
Configuration Protocol (DHCP).
a) Voice and video traffic is generally transmitted
using UDP. Real-time video and audio streaming
protocols are designed to handle occasional lost
packets, so only slight degradation in quality
occurs, rather than large delays if lost packets were
retransmitted.
b) Because both TCP and UDP run over the same
network, many businesses are finding that a recent
increase in UDP traffic from these real-time
applications is hindering the performance of
applications using TCP, such as point of sale,
accounting, and database systems.
Transmission Control Protocol (TCP
a) The Transmission Control Protocol (TCP) is one of
the core protocols of the Internet Protocol Suite
b) TCP provides reliable, ordered delivery of a stream
of bytes from a program on one computer to
another program on another computer.
c) TCP is the protocol used by major Internet
applications such as the World Wide Web, email,
remote administration and file transfer. TCP
provides a communication service at an
intermediate level between an application program
and the Internet Protocol (IP).
a) That is, when an application program desires
to send a large chunk of data across the
Internet using IP, instead of breaking the data
into IP-sized pieces and issuing a series of IP
requests, the software can issue a single
request to TCP and let TCP handle the IP
details.
a) IP works by exchanging pieces of information
called packets.
b) A packet consists of a header followed by a
body.
c) The header describes the packet's destination
and, optionally, the routers to use for
forwarding until it arrives at its destination.
The body contains the data IP is transmitting.
a) Due to network congestion, traffic load balancing,
or other unpredictable network behavior, IP packets
can be lost, duplicated, or delivered out of order.
b) TCP detects these problems, requests
retransmission of lost data, rearranges out-of-order
data, and even helps minimize network congestion
to reduce the occurrence of the other problems.
c) Once the TCP receiver has reassembled the
sequence of octets originally transmitted, it passes
them to the application program. Thus, TCP
abstracts the application's communication from the
underlying networking details.
a) TCP is used for applications such as the
World Wide Web (WWW), E-mail, File
Transfer Protocol, Secure Shell, peer-to-peer
file sharing, and some streaming media
applications.
a) TCP is optimized for accurate delivery rather
than timely delivery, and therefore, TCP
sometimes incurs relatively long delays (some
seconds) while waiting for out-of-order
messages or retransmissions of lost messages.
b) It is not suitable for real-time applications
such as Voice over IP. For such applications,
protocols like the Real-time Transport
Protocol (RTP) running over the User
Datagram Protocol (UDP) are usually used.
a) TCP is a reliable stream delivery service that
guarantees that all bytes received will be identical
with bytes sent and in the correct order.
b) Since packet transfer is not reliable, a technique
known as positive acknowledgment with
retransmission is used to guarantee reliability of
packet transfers.
c) This fundamental technique requires the receiver to
respond with an acknowledgment message as it
receives the data. The sender keeps a record of each
packet it sends.
a) The sender also keeps a timer from when the packet
was sent, and retransmits a packet if the timer
expires before the message has been acknowledged.
The timer is needed in case a packet gets lost or
corrupted.
a) The sender also keeps a timer from when the
packet was sent, and retransmits a packet if
the timer expires before the message has been
acknowledged. The timer is needed in case a
packet gets lost or corrupted.
b) A TCP segment consists of a segment header
and a data section. The TCP header contains
10 mandatory fields, and an optional
extension field
a) Source port: 16 Bit number which
identifies the Source Port number
(Sending Computer's TCP Port).
b) Destination port: 16 Bit number which
identifies the Destination Port number
(Receiving Port).
a) Sequence number: 32 Bit number used for byte
level numbering of TCP segments. If you are using
TCP, each byte of data is assigned a sequence
number.
b) If SYN flag is set (during the initial three way
handshake connection initiation), then this is the
initial sequence number. The sequence number of
the actual first data byte will then be this sequence
number plus 1.
c) For example, let the first byte of data by a device in
a particular TCP header will have its sequence
number in this field 50000. If this packet has 500
bytes of data in it, then the next packet sent by this
device will have the sequence number of 50000 +
500 + 1 = 50501.
a) Acknowledgment Number: 32 Bit number
field which indicates the next sequence
number that the sending device is expecting
from the other device. ( Server to client)
b) Header Length: 4 Bit field which shows the
number of 32 Bit words in the header. Also
known as the Data Offset field. The minimum
size header is 5 words (binary pattern is
0101).
c) Reserved: Always set to 0 (Size 6 bits).
a) PSH: This flag means Push function. Using this
flag, TCP allows a sending application to specify
that the data must be pushed immediately. When an
application requests the TCP to push data, the TCP
should send the data that has accumulated without
waiting to fill the segment.
a) RST: Reset the connection. The RST bit is used to
RESET the TCP connection due to unrecoverable
errors.
b) When an RST is received in a TCP segment, the
receiver must respond by immediately terminating
the connection.
c) A RESET causes both sides immediately to release
the connection and all its resources. As a result,
transfer of data ceases in both directions, which
can result in loss of data that is in transit. A TCP
RST indicates an abnormal terminination of the
connection.
a) Control Bit Flags: We have seen before that TCP is
a Connection Oriented Protocol.
b) The meaning of Connection Oriented Protocol is
that, before any data can be transmitted, a reliable
connection must be obtained and acknowledged.
c) Control Bits govern the entire process of
connection establishment, data transmissions and
connection termination. The control bits are listed
as follows: They are:
d) URG: Urgent Pointer.
e) ACK: Acknowledgement.
a) FIN: No more data from the sender. Receiving a
TCP segment with the FIN flag does not mean that
transferring data in the opposite direction is not
possible. Because TCP is a fully duplex connection,
the FIN flag will cause the closing of connection
only in one direction. To close a TCP connection
gracefully, applications use the FIN flag
b) Window: indicates the size of the receive window,
which specifies the number of bytes beyond the
sequence number in the acknowledgment field that
the receiver is currently willing to receive.
a) Checksum: The 16-bit checksum field is used for error-
checking of the header and data.
b) Urgent Pointer: Shows the end of the urgent data so that
interrupted data streams can continue. When the URG bit is
set, the data is given priority over other data streams (Size
16 bits).
Key Features of TCP
a) Some key features of TCP that set TCP apart from
User Datagram Protocol are:
b) • Ordered data transfer — the destination host
rearranges according to sequence number
c) • Retransmission of lost packets — any cumulative
stream not acknowledged is retransmitted
d) • Error-free data transfer
e) • Flow control — limits the rate a sender transfers
data to guarantee reliable delivery. The receiver
continually hints the sender on how much data can
be received.
a) When the receiving host's buffer fills, the next
acknowledgment contains a 0 in the window
size, to stop transfer and allow the data in the
buffer to be processed.
b) • Congestion control
TCP vs UDP
a) Transmission Control Protocol is a
connection-oriented protocol, which means
that it requires handshaking to set up end-to-
end communications. Once a connection is set
up user data may be sent bi-directionally over
the connection.
TCP
a) Reliable – TCP manages message
acknowledgment, retransmission and timeout.
Multiple attempts to deliver the message are
made. If it gets lost along the way, the server
will re-request the lost part. In TCP, there's
either no missing data, or, in case of multiple
timeouts, the connection is dropped.
a) Ordered – if two messages are sent over a
connection in sequence, the first message will reach
the receiving application first. When data segments
arrive in the wrong order, TCP buffers the out-of-
order data until all data can be properly re-ordered
and delivered to the application.
a) • Heavyweight – TCP requires three packets
to set up a socket connection, before any user
data can be sent. TCP handles reliability and
congestion control.
b) • Streaming – Data is read as a byte stream, no
distinguishing indications are transmitted to
signal message (segment) boundaries.
UDP
a) UDP is a simpler message-based connectionless
protocol. Connectionless protocols do not set up a
dedicated end-to-end connection.
b) Communication is achieved by transmitting
information in one direction from source to
destination without verifying the readiness or state
of the receiver.
c) However, one primary benefit of UDP over TCP is
the application to voice over internet protocol
(VoIP) where any handshaking would hinder clear
voice communication.
d) It is assumed in VoIP UDP that the end users
provide any necessary real time confirmation that
a) Unreliable – When a message is sent, it
cannot be known if it will reach its
destination; it could get lost along the way.
There is no concept of acknowledgment,
retransmission, or timeout.
b) Not ordered – If two messages are sent to the
same recipient, the order in which they arrive
cannot be predicted.
c) Lightweight – There is no ordering of
messages, no tracking connections, etc. It is a
small transport layer designed on top of IP.
a) Datagram – Packets are sent individually and
are checked for integrity only if they arrive.
Packets have definite boundaries which are
honored upon receipt, meaning a read
operation at the receiver socket will yield an
entire message as it was originally sent.
b) No congestion control – UDP itself does not
avoid congestion, and it's possible for high
bandwidth applications to trigger congestion
collapse, unless they implement congestion
control measures at the application level.
TCP Service Model (3)
All TCP connections are full-duplex and point-to-point.

TCP provides a byte stream. i.e it does not preserve


message boundaries

At sender TCP may immediately send or buffer data at


its discretion.

Sender can use a PUSH flag to instruct TCP not to


buffer the send.

Sender can use URGENT flag to have TCP send data


immediately and have the receiver TCP signal the
receiver application that there is data to be read.
Some TCP features
Every byte has its own 32 bit sequence number.

Sending and receiving entities exchange data in segments

Each segment is the 20 byte header and data (total up to 64K)

TCP may aggregate multiple writes into one segment or split


one write into several segments.

A segment size if the smaller of either 64K or the MTU of the


network layer (MTU of Ethernet is about 1500 bytes)

A segment must fit in a single IP payload.


Some TCP features
TCP uses the sliding window protocol as its base.

Sender sends segment, starts timer waits for ACK.


It no ACK then retransmit. Receiver acks in
separate segment or “piggyback” on data segment.

TCP must deal with reordred segments.

A lot of algorithms have been developed to make


TCP efficient under diverse network conditions..

You might also like