CN Unit 4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 59

Transport Layer

Unit 4
Introduction
• Transport Layer is the second layer in the TCP/IP model and the fourth
layer in the OSI model.
• The transport layer is responsible for providing services to the
application layer; it receives services from the network layer.
Working of Transport Layer:
• At the sender’s side: The transport layer receives data (message)
from the Application layer and then performs Segmentation, divides
the actual message into segments, adds source and destination’s port
numbers into the header of the segment, and transfers the message
to the Network layer.
Cont..
• At the receiver’s side: The transport layer receives data from the
Network layer, reassembles the segmented data, reads its header,
identifies the port number, and forwards the message to the
appropriate port in the Application layer.
Services Provide by TL
Cont..
Multiplexing
• The transport layer uses the multiplexing to improve transmission efficiency.
Multiplexing can occur in two ways:
• Upward multiplexing: Upward multiplexing means multiple transport layer connections use the
same network connection. To make more cost-effective, the transport layer sends several
transmissions bound for the same destination along the same path; this is achieved through
upward multiplexing.

•Downward multiplexing: Downward


multiplexing means one transport layer
connection uses multiple network connections.
Downward multiplexing allows the transport
layer to split a connection among several paths
to improve the throughput. This type of
multiplexing is used when networks have a low
or slow capacity.
Transport Layer Protocol
• The transport layer is represented by two protocols:
• TCP (Transmission Control Protocol)
• UDP (User Datagram Protocol)

• Connection-oriented protocol is TCP


• Connectionless protocol is UPD
User Datagram Protocol
Connectionless protocol
• UDP transmits the data directly to the destination computer without
verifying whether the receiver is ready to receive or not.
• UDP is Faster as error recovery is not attempted
• It doesn't retransmit the damage frame or accept the
acknowledgment.
Cont..
User Datagram Format
• The user datagram has a 8 byte header size
Transmission Control Protocol
• In TCP, the connection is established by using three-way handshaking.
It is a Connection-Oriented protocol
• The speed of TCP is slower
• It waits for the acknowledgement of data and has the ability to
resend the lost packets.
Cont.. Source port address: It is used to
define the address of the
TCP Segment Format application program in a source
computer. It is a 16-bit field.
• The TCP has a 20 byte header size
Destination port address: It is
used to define the address of the
application program in a
destination computer. It is a 16-bit
field.
Sequence number: A stream of
data is divided into two or more
TCP segments. The 32-bit
sequence number field represents
the position of the data in an
original data stream.
Cont..
• Acknowledgement number: A 32-field acknowledgement number
acknowledge the data from other communicating devices. If ACK field is set
to 1, then it specifies the sequence number that the receiver is expecting
to receive.
• Header Length (HLEN): It specifies the size of the TCP header in 32-bit
words. The minimum size of the header is 5 words, and the maximum size
of the header is 15 words. Therefore, the maximum size of the TCP header
is 60 bytes, and the minimum size of the TCP header is 20 bytes.
• Reserved: It is a six-bit field which is reserved for future use.
• Control bits: Each bit of a control field functions individually and
independently. A control bit defines the use of a segment or serves as a
validity check for other fields.
Cont..
Cont..
• Window size
It is a 16-bit field. It contains the size of data that the receiver can accept.
This field is used for the flow control between the sender and receiver and
also determines the amount of buffer allocated by the receiver for a
segment.
• Checksum
It is a 16-bit field. This field is optional in UDP, but in the case of TCP/IP, this
field is mandatory. For error detection and correction
• Urgent pointer
It is a pointer that points to the urgent data byte if the URG flag is set to 1.
It defines a value that will be added to the sequence number to get the
sequence number of the last urgent byte.
• Options
It provides additional options. The optional field is represented in 32-bits. If
this field contains the data less than 32-bit, then padding is required to
obtain the remaining bits.
TCP Services

Process-to-Process
Communication
• TCP provides a process to
process communication, i.e,
the transfer of data that takes
place between individual
processes executing on end
systems. This is done using
port numbers.
• Some well-known port
numbers used by TCP.
Cont..
Stream Oriented
• This means that the data is sent and received as a stream of
bytes(unlike UDP or IP that divides the bits into datagrams or
packets).
• TCP creates an environment in which the two processes seem to be
connected by an imaginary "tube" that carries their data across the
Internet.
• The sending process produces (writes to) the stream of bytes, and the
receiving process consumes (reads from) them.
Cont..
Sending and Receiving Buffers
• Because the sending and the receiving processes may not write or
read data at the same speed, TCP needs buffers for storage.
• There are two buffers, the sending buffer and the receiving buffer,
one for each direction and these buffers are also necessary for flow
and error control mechanisms used by TCP.
Cont..
Segment
• The IP layer, as a service provider for TCP, needs to send data in
packets, not as a stream of bytes.
• At the transport layer, TCP groups a number of bytes together into a
packet called a segment.
• TCP adds a header to each segment (for control purposes) and
delivers the segment to the IP layer for transmission.
Cont..
Full-duplex service
• This means that the communication can take place in both directions
at the same time.
Connection-oriented service
• Unlike UDP, TCP provides a connection-oriented service. It defines 3
different phases:
• Connection establishment
• Data transfer
• Connection termination
Cont..

Reliability
• TCP is reliable as it uses checksum for error detection, attempts to
recover lost or corrupted packets by re-transmission,
acknowledgement policy and timers.
Multiplexing –
• TCP does multiplexing and de-multiplexing at the sender and receiver
ends respectively as a number of logical connections can be
established between port numbers over a physical connection.
TCP Features
• TCP is reliable protocol. That is, the receiver always sends either positive or
negative acknowledgement about the data packet to the sender, so that
the sender always has bright clue about whether the data packet is
reached the destination or it needs to resend it.
• TCP ensures that the data reaches intended destination in the same order
it was sent.
• TCP is connection oriented. TCP requires that connection between two
remote points be established before sending actual data.
• TCP provides error-checking and recovery mechanism.
• TCP provides end-to-end communication.
• TCP provides flow control and quality of service.
• TCP operates in Client/Server point-to-point mode.
• TCP provides full duplex server, i.e. it can perform roles of both receiver
and sender.
TCP Connection
• To make the transport services reliable, TCP hosts must establish a
connection-oriented session with one another.
• Connection establishment is performed by using the three-way handshake
mechanism. A three-way handshake synchronizes both ends of a network
by enabling both sides to agree upon original sequence numbers.
• This mechanism also provides that both sides are ready to transmit data
and learn that the other side is available to communicate.
• This is essential so that packets are not shared or retransmitted during
session establishment or after session termination.
Cont..
TCP Connection Establishment
• The requesting end (Host A) sends an SYN
segment determining the server's port
number that the client needs to connect to
and its initial sequence number (x).
• The server (Host B) acknowledges its own
SYN segment, including the servers initial
sequence number (y). The server also
responds to the client SYN by accepting the
sender's SYN plus one (X + 1).
• An SYN consumes one sequence number. The
client should acknowledge this SYN from the
server by accepting the server's SEQ plus one
(SEQ = x, ACK = y + 1). This is how a TCP
connection is settled.
Cont..
Cont..
TCP Connection termination
• The rule is that either end can share a FIN
when it has finished sending data.
• When a TCP receives a FIN, it should notify
the application that the other end has
terminated that data flow direction. The
sending of a FIN is usually the result of the
application issuing a close.
• A TCP can send data after receiving a FIN.
The end that first issues the close (example,
send the first FIN) executes the active close. Therefore TCP Connection
termination is 4 way Handshake
The other end (that receives this FIN)
manages the passive close.
TCP Congestion Control
• Congestion occurs, if the load offered to any network is more than its
capability
• TCP Controls congestion by means of window mechanisms (to manage the flow
of packets between two computers or network hosts)
• TCP sets a window size telling the other end how much data segment to
send.
Congestion policy or algorithm in TCP –
1.Slow Start Phase
2.Congestion Avoidance Phase: After reaching the threshold increment is by 1
3.Congestion Detection Phase: Sender goes back to Slow start phase or
Congestion avoidance phase.
1. Slow Start Phase-
Cont..
• Starts slowly, size of congestion window increases exponential to
threshold
• Initially, sender sets congestion window size = Maximum Segment
Size (1 MSS).
• After receiving each acknowledgment, sender increases the
congestion window size by 1 MSS.
Cont..
Congestion window (CWND)

• After 1 round trip time,


congestion window size = (2)1 =
2 MSS
• After 2 round trip time,
congestion window size = (2)2 =
4 MSS
• After 3 round trip time,
congestion window size = (2)3 =
8 MSS and so on.
Cont..
2. Congestion Avoidance Phase-
• This phase starts after reaching the threshold,
• Sender increases the congestion window size to avoid the congestion.
• On receiving each acknowledgement, sender linear increments the
congestion window size by 1.
Cont..
• This phase
continues until
the congestion
window size
becomes equal
to the receiver
window size.
Cont..
3. Congestion Detection Phase-
• If congestion occurs, the congestion window size is decreased.
• The only way a sender can guess that congestion has occurred is the
need to retransmit a segment.
• Retransmission is needed to recover a missing packet that is assumed
to have been dropped by a router due to congestion.
• Retransmission can occur in one of two cases:
• when the connection times out or
• when three duplicate ACKs are received.
Cont..
If a time-out occurs, there is a stronger possibility of congestion; a
segment has probably been dropped in the network and there is no
news about the following sent segments.
In this case TCP reacts strongly:
a. It sets the value of the threshold to half of the current
window size.
b. It reduces cwnd back to one segment.
c. It starts the slow start phase again.
Cont..
If three duplicate ACKs are received, there is a weaker possibility of
congestion; a segment may have been dropped but some segments
after that have arrived safely since three duplicate ACKs are received.
This is called fast transmission and fast recovery. In this case, TCP has
a weaker reaction as shown below:
a. It sets the value of the threshold to half of the current
window size.
b. It sets cwnd to the value of the threshold (set cwnd=
threshold).
c. It starts the congestion avoidance phase.
FLOW CONTROL in TCP
• In a communication network, in order for two network hosts to
communicate with each other, one has to send a packet while
another host has to receive it.
• It might happen that both the hosts have
different hardware and software specifications and accordingly
their processors might differ.
• If the receiver host has a fast processor which can consume
messages sent at a higher rate by the sender then the
communication works well and no problem will occur.
Cont..
How does Flow Control in TCP Work?
• When the data is sent on the network, this is what normally
happens in the network layer.

• The sender writes the data to a socket


and sends it to the transport layer
which is TCP in this case.
• The transport layer will then wrap
this data and will send it to the
network layer which will route it to
the receiving node.
Cont..
• The TCP stores the data that
needs to be sent in the
send buffer and the data to be
received in the receive buffer.
• Flow control makes sure that no
more packets are sent by the
sender once the receiver’s buffer
is full as the messages will be
dropped and the receiver won’t
be able to handle them.
• In order to control the amount of
data sent by the TCP, the receiver
will create a buffer which is also
known as Receive Window.
Error Control in TCP
• TCP protocol has methods for finding out corrupted segments,
missing segments, out-of-order segments and duplicated segments.
• Error control in TCP is mainly done through the use of three simple
techniques :
1.Checksum – Every segment contains a checksum field which is used
to find corrupted segments. If the segment is corrupted, then that
segment is discarded by the destination TCP and is considered lost.
• Acknowledgement – TCP has another mechanism called
acknowledgement to affirm that the data segments have been
delivered. Control segments that contain no data but have sequence
numbers will be acknowledged as well but ACK segments are not
acknowledged.
Cont..
• Retransmission – When a segment is missing, delayed to deliver to a
receiver, corrupted when it is checked by the receiver then that
segment is retransmitted again. Segments are retransmitted only
during two events: when the sender receives three duplicate
acknowledgements (ACK) or when a retransmission timer expires.
• Retransmission after RTO: TCP always preserves one retransmission time-out
(RTO) timer for all sent but not acknowledged segments.
• Retransmission after Three duplicate ACK segments: Sometimes one segment
is lost and the receiver receives so many out-of-order segments that they cannot be
saved. In order to solve this situation, three duplicate acknowledgement method is
used and missing segment is retransmitted immediately instead of retransmitting
already delivered segment. This is a fast retransmission because it makes it possible
to quickly retransmit lost segments instead of waiting for timer to end.
Application Layer: www
• The application layer in the OSI model is the closest layer to the end
user which means that the application layer and end user can interact
directly with the software application. The application layer programs
are based on client and servers.
What is World Wide Web (WWW)?
• World Wide Web, which is also known as a Web, is a collection of
websites or web pages stored in web servers and connected to local
computers through the internet.
• These websites contain text pages, digital images, audios, videos, etc.
Users can access the content of these sites from any part of the world
over the internet using their devices such as computers, laptops, cell
phones, etc.
Cont..
• The building blocks of the Web are web pages which are formatted in
HTML and connected by links called "hypertext" or hyperlinks and
accessed by HTTP.
• A web page is given an online address called a Uniform Resource
Locator (URL). A particular collection of web pages that belong to a
specific URL is called a website,
e.g., www.facebook.com, www.google.com, etc. So, the World Wide
Web is like a huge electronic book whose pages are stored on
multiple servers across the world.
Cont..
History of the World Wide Web:
• The World Wide Web was invented by a British scientist, Tim Berners-
Lee in 1989. He was working at CERN at that time.
• CERN, where Tim Berners worked, is a community of more than 1700
scientists from more than 100 countries.
• Internet and Hypertext were available at this time, but no one
thought how to use the internet to link or share one document to
another.
• Tim focused on three main technologies that could make computers
understand each other, HTML, URL, and HTTP.
Cont..
• How the World Wide Web Works?
Cont..
• Hypertext Markup Language (HTML):

• Hypertext Transfer Protocol (HTTP):


• Hyper Text Transfer Protocol (HTTP) is an application layer
protocol which enables WWW to work smoothly and effectively.
• It is based on a client-server model. The client is a web browser
which communicates with the web server which hosts the
website.
E-Mail
• Electronic mail, commonly known as email, is a method of
exchanging messages over the internet. Here are the basics of email:
1.An email address: This is a unique identifier for each user, typically in
the format of [email protected].
2.An email client: This is a software program used to send, receive and
manage emails, such as Gmail, Outlook, or Apple Mail.
3.An email server: This is a computer system responsible for storing
and forwarding emails to their intended recipients.
Cont..
• Email protocols are a collection of protocols that are used to send and
receive emails properly.
• The email protocols provide the ability for the client to transmit the mail to
or from the intended mail server. Email protocols are a set of commands
for sharing mails between two computers.
• Email protocols establish communication between the sender and receiver
for the transmission of email. Email forwarding includes components like
two computers sending and receiving emails and the mail server. There are
three basic types of email protocols.
Types of Email Protocols:
• Three basic types of email protocols involved for sending and receiving
mails are:
• SMTP
• POP3
• IMAP
Cont..
Cont..
SMTP (Simple Mail Transfer Protocol):
• Simple Mail Transfer Protocol is used to send mails over the internet. SMTP
is an application layer and connection-oriented protocol. SMTP is efficient
and reliable for sending emails.
• SMTP uses TCP as the transport layer protocol. It handles the sending and
receiving of messages between email servers over a TCP/IP network.
• This protocol along with sending emails also provides the feature of
notification for incoming mails. When a sender sends an email then the
sender’s mail client sends it to the sender’s mail server and then it is sent
to the receiver mail server through SMTP.
• SMTP commands are used to identify the sender and receiver email
addresses along with the message to be sent.
• Some of the SMTP commands are HELLO, MAIL FROM, RCPT TO, DATA,
QUIT, VERIFY, SIZE, etc.
• SMTP sends an error message if the mail is not delivered to the receiver
hence, reliable protocol.
Cont..
POP(Post Office Protocol):
• Post Office Protocol is used to retrieve email for a single client. POP3
version is the current version of POP used.
• It is an application layer protocol. It allows to access mail offline and
thus, needs less internet time. To access the message it has to be
downloaded.
• POP allows only a single mailbox to be created on the mail server.
POP does not allow search facilities
• Some of the POP commands are LOG IN, STAT, LIST, RETR, DELE, RSET,
and QUIT.
Cont..
• IMAP(Internet Message Access Protocol):
• Internet Message Access Protocol is used to retrieve mails for multiple
clients.
• There are several IMAP versions: IMAP, IMAP2, IMAP3, IMAP4, etc. IMAP is
an application layer protocol.
• IMAP allows to access email without downloading them and also supports
email download.
• The emails are maintained by the remote server. It enables all email
operations such as creating, manipulating, delete the email without
reading it. IMAP allows you to search emails.
• It allows multiple mailboxes to be created on multiple mail servers and
allows concurrent access. Some of the IMAP commands are: IMAP_LOGIN,
CREATE, DELETE, RENAME, SELECT, EXAMINE, and LOGOUT.
Domain Name System (DNS)

• DNS is a hostname for IP address translation service.


• DNS is a distributed database implemented in a hierarchy of name
servers.
• It is an application layer protocol for message exchange between
clients and servers.
• DNS is used to convert the domain name of the websites to their
numerical IP address.
Cont..
• Domain: There are various kinds of DOMAIN:
1.Generic domain: .com(commercial) .edu(educational) .mil(military)
.org(non profit organization) .net(similar to commercial) all these are
generic domain.
2.Country domain .in (india) .us .uk
3.Inverse domain if we want to know what is the domain name of the
website.
Ip to domain name mapping.
So DNS can provide both the mapping for example to find the ip
addresses of tjohncollege.edu then we have to type nslookup
www.tjohncollege.edu.
Cont..
• Organization of Domain:
Cont..
• DNS record: Domain name, ip address what is the validity?? what is
the time to live ?? and all the information related to that domain
name. These records are stored in tree like structure.
• Namespace: Set of possible names, flat or hierarchical. The naming
system maintains a collection of bindings of names to values – given a
name, a resolution mechanism returns the corresponding value.
• Name server: It is an implementation of the resolution mechanism.
DNS (Domain Name System) = Name service in Internet – Zone is an
administrative unit, domain is a subtree.
• Name to Address Resolution:
Cont..
Flow control to improves QoS
• Quality of Service (QoS) is a group of technologies that operate on a
network to ensure that high-priority traffic and applications may be
reliably carried out even when the network's capacity is
constrained.
• Additionally, the QoS specifies that supporting priority for one or
more flows will not fail other flows.
• A flow can consist of a packet from a particular application or an
incoming interface as well as source and destination addresses,
source and destination socket numbers, session identifiers, and
packets.
• Why is QoS Important?
Cont..
• QoS is essential to ensure the overall
performance of essential packages that
require excessive bandwidth for real-time
visitors.
• QoS facilitates agencies to save you the
postponement of those touchy packages,
ensuring they carry out to the extent
customers require.
• QoS is more essential as community overall
performance necessities adapt to the
developing variety of human beings' usage of
them.
• QoS is likewise turning more essential because
the Internet of Things (IoT) keeps returning to
maturity.
• QoS allows the statistics to circulate to take
precedence withinside the community and
guarantees that the statistics flow as fast as
possible.
Cont..
Techniques Involved in QoS
Scheduling :
• Packets from one-of-a-kind flows arrive at a transfer or router for
processing. An exact scheduling approach treats the one-of-a-kind flows
truthfully and suitably. Several scheduling strategies are designed to
enhance the exceptional of the provider.
• FIFO Queuing Packets wait in a buffer (queue) in first-in, first-out (FIFO)
queuing until the node (router or switch) is prepared to process them.
• Priority Queuing Packets are first given a priority class in priority
queuing. Each type of priority has its own queue. The first packets
processed are those in the queue with the highest priority.
• Weighted Fair Queuing The packets are still allowed to various queues
and assigned to various classes in this method. The queues are, however,
weighted according to their priority; a higher priority corresponds to a
higher weight.
Cont..
Traffic Shaping :
• Traffic shaping is a mechanism to manipulate the quantity and the
price of the visitors despatched to the network. Two strategies can
form visitors: Leaky Bucket and Token Bucket.
• Leaky Bucket:
Cont..
• The leaky bucket algorithm is a technique for creating a set-rate
output of packets by grouping a variable number of requests into
temporary storage.
• This fundamental idea is used in the Leaky Bucket Algorithm, which
is nothing more than a single server queueing system with constant
service time.
• Think of a bucket that has a hole in the bottom. No matter how
quickly water enters the bucket, it always seeps out through the
hole at the same rate. If there is no water in the bucket, the rate of
flow is zero; if the bucket is full, any extra water pours out and is
lost.
Cont..
Token Bucket
• It is possible to design a conventional
token bucket shaper as a counter that
increments at a rate corresponding to
the desired shaping bandwidth.
• The next packet in the queue is
transmitted, and the counter is
decremented by the size of the packet
when the counter reaches a value equal
to its size in bytes. In this manner, a
particular queue's sent bytes per
second will be proportionate to the
counter rate.
• To reduce downstream congestion, this
kind of traffic shaping is frequently
utilized in the outgoing switch ports of
systems.
Integrated Services
• In the application layer, integrated services or IntServ is an
architecture that specifies the elements to guarantee the quality of
service (QoS) on networks.
• IntServ can for example be used to allow video and sound to reach
the receiver without interruption.
Besides end-to-end signaling, IntServ requires several functions on
routers and switches along the path:
Admission Control: determine whether a new flow can be granted the
requested QoS without impacting existing reservations
• Classification: recognize packets that need particular levels of QoS
• Policing: take action, including possibly dropping packets, when traffic
does not conform to its specified characteristics
• Queuing and Scheduling: forward packets according to those QoS
requests that have been granted

You might also like