0% found this document useful (0 votes)
4 views

unit-3

Framing in computer networks is the process of dividing data into smaller units called frames, which are essential for ensuring data integrity, security, and efficient transmission. It operates at the data link layer and includes components like headers, payloads, and trailers for error detection and control. There are various types of framing, including fixed-size and variable-size framing, each with its advantages and disadvantages, as well as different protocols to manage the transmission of frames.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

unit-3

Framing in computer networks is the process of dividing data into smaller units called frames, which are essential for ensuring data integrity, security, and efficient transmission. It operates at the data link layer and includes components like headers, payloads, and trailers for error detection and control. There are various types of framing, including fixed-size and variable-size framing, each with its advantages and disadvantages, as well as different protocols to manage the transmission of frames.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

What is Framing in Computer Networks?

Framing is a process of dividing a stream of data into smaller, more manageable


units called frames. The frames are then transmitted over the network and
reassembled at the receiving end to recreate the original data stream. Framing is
important in computer networks because it helps ensure data integrity and
security by allowing the receiver to detect errors and prevent unauthorized
access

Framing is a point-to-point connection between two computers or devices


consisting of a wire in which data is transmitted as a stream of bits. However,
these bits must be framed into discernible blocks of information. Framing is a
function of the data link layer. It provides a way for a sender to transmit a set
of bits that are meaningful to the receiver. Ethernet, token ring, frame relay,
and other data link layer technologies have their own frame structures. Frames
have headers that contain information such as error-checking codes.

Parts of Frame

A frame generally has the following parts:

 Frame Header: It contains the source and destination address of the frame.
 Payload Field: It will contain the message which is needed to be delivered.
 Trailer: It contains the error correction and error detection bits.
 Flag: It marks the beginning and the end of the frame.

How does Framing Work?

 Framing is done in computer networks by combining hardware and software.


Hardware-level network devices like switches and routers divide the data
stream into frames using specialized processors. Then, using a system like
Ethernet, these frames are transmitted across the network.
 Framing is usually dealt with at the program level by a network protocol like
the Point-to-Point Protocol (PPP) or the High-Level Data Link Control
(HDLC).

 The source and target identifiers, error-checking codes, and other control
information are added as headers and trailers by these protocols to each
frame.

 The same protocol and hardware are used to put the frames back together
into the initial data stream after they have been delivered to the target. The
receiving device checks each frame for errors and drops any frames that fail
the error-checking process.

Why is Framing Important in Computer Networks?

Framing in computer networks is very essential because it helps ensure the


security and integrity of data transmitted over the network. It will be quite
difficult to check for unauthorized access or errors without framing and that will
lead to compromise in the network.

Framing also supports efficient data transmission over the network. In framing,
we divide the main data into smaller frames, which will lead to more efficiency,
reduction in congestion network, and improve overall network performance for
network devices.

Types of Framing in Computer Networks

There are mainly two types of framing and those are explained below:
Fixed Size Framing

Fixed-size framing involves dividing the data into frames of a predetermined,


fixed size. This approach is commonly used in networks such as Ethernet,
where each frame is exactly 1500 bytes long.

The advantage of fixed-size framing is that

 it is simple and efficient, as all frames are of the same size.

 This makes it easy for network devices to split the data stream into
frames, and for the receiving device to know how much data is in each
frame.

 Fixed-size framing also makes it easier to manage network resources, as


it ensures that each frame takes up the same amount of bandwidth.

 This is important in high-speed networks where a large amount of data is


being transmitted simultaneously.

 Furthermore, fixed-size framing is suitable for data that can be easily


divided into smaller units, such as text files or structured data.

Dis advantages:

 it may not be suitable for all types of data.

 For example, video or audio files may not fit neatly into fixed-size
frames, as their size and complexity may vary.

 it can introduce additional overhead, as some frames may contain unused


space if the data being transmitted does not fill the entire frame.

Variable Size Framing

Variable size framing involves dividing the data into frames of varying sizes.
This approach is commonly used in networks where the data being transmitted
does not fit neatly into fixed-size frames, such as video or audio streaming. In
variable-size framing, each frame contains a header that specifies the length of
the payload, allowing the receiving device to know how much data is in each
frame.

The advantage of variable-size framing is that


 it provides more flexibility than fixed-size framing.

 Frames can be sized to fit the data being transmitted, which can help to
reduce overhead and increase efficiency.

 This is particularly important in applications where data may be of


varying sizes, such as multimedia streaming.

Dis advantages:

 It can be more complex to implement, as each frame must contain a


header specifying the length of the payload.

 This increases the overhead of each frame, which can reduce overall
network efficiency.

 Additionally, variable-size framing can introduce additional delay, as the


receiver must wait for the entire frame to be received before processing it.

Approaches of Framing in Computer Networks

There are two main types of framing approaches used in computer networks:
byte-oriented framing and bit-oriented framing.

Byte-oriented Framing

Byte-oriented framing is the most common type of framing technique used in


computer networks. As the name suggests, byte-oriented framing divides data
into fixed-length bytes, which are then encapsulated into frames. The frames
contain a header, a payload, and a trailer. The header and trailer provide control
information such as the source and destination addresses, error-checking codes,
and other control information.

Byte-oriented framing is widely used in network protocols such as Ethernet and


TCP/IP. It is also used in file transfer protocols such as FTP and HTTP.

Bit-oriented Framing

Bit-oriented framing, also known as character-oriented framing, divides data


into variable-length units called characters. Each character is then encapsulated
into frames, which contain a header, a payload, and a trailer.
Bit-oriented framing is less common than byte-oriented framing but is still used
in some network protocols such as the Synchronous Data Link Control (SDLC)
protocol used by IBM mainframes.

Advantages of Framing

Some of the advantages of framing are explained below:

 Data Integrity: It provides error detection and error correction mechanism


which in turn ensure the integrity of the transmitted data over the network.
 Security: Framing also helps ensure network security by preventing
unauthorized access to data.
 Efficient Data Transmission: By dividing the total data into smaller frames the
framing makes the data transmission more efficient and low network congestion
with improved overall performance.
Disadvantages of Framing

Here are some of the disadvantages of framing:

 Overhead: Framing adds overhead to the main data stream which in turn
reduces the content of actual data that can be transmitted over the network.
 Complexity: We need to use both hardware and software mechanisms to
implement framing which increases the complexity.
 Delay: Framing sometimes leads to delay in large networks, as multiple frames
are transferred simultaneously.
Elementary Data link Protocols:

 Protocols in the data link layer are designed so that this layer can perform
its basic functions: framing, error control and flow control.

 Framing is the process of dividing bit - streams from physical layer into data
frames whose size ranges from a few hundred to a few thousand bytes. Error
control mechanisms deals with transmission errors and retransmission of
corrupted and lost frames. Flow control regulates speed of delivery and so
that a fast sender does not drown a slow receiver.

Types of Data Link Protocols

Data link protocols can be broadly divided into two categories, depending on
whether the transmission channel is noiseless or noisy.

Simplex Protocol

The Simplex protocol is hypothetical protocol designed for unidirectional data


transmission over an ideal channel, i.e. a channel through which transmission
can never go wrong. It has distinct procedures for sender and receiver. The
sender simply sends all its data available onto the channel as soon as they are
available its buffer. The receiver is assumed to process all incoming data
instantly. It is hypothetical since it does not handle flow control or error control.

Stop – and – Wait Protocol

Stop – and – Wait protocol is for noiseless channel too. It provides


unidirectional data transmission without any error control facilities. However, it
provides for flow control so that a fast sender does not drown a slow receiver.
The receiver has a finite buffer size with finite processing speed. The sender can
send a frame only when it has received indication from the receiver that it is
available for further data processing.
Stop – and – Wait ARQ

Stop – and – wait Automatic Repeat Request (Stop – and – Wait ARQ) is a
variation of the above protocol with added error control mechanisms,
appropriate for noisy channels. The sender keeps a copy of the sent frame. It
then waits for a finite time to receive a positive acknowledgement from
receiver. If the timer expires or a negative acknowledgement is received, the
frame is retransmitted. If a positive acknowledgement is received then the next
frame is sent.

Go – Back – N ARQ

Go – Back – N ARQ provides for sending multiple frames before receiving the
acknowledgement for the first frame. It uses the concept of sliding window, and
so is also called sliding window protocol. The frames are sequentially numbered
and a finite number of frames are sent. If the acknowledgement of a frame is not
received within the time period, all frames starting from that frame are
retransmitted.

Selective Repeat ARQ

This protocol also provides for sending multiple frames before receiving the
acknowledgement for the first frame. However, here only the erroneous or lost
frames are retransmitted, while the good frames are received and buffered.

Why is Elementary Data Link Protocols needed?

Data Link Layer communicates with the network layer and physical layer.
Generally, the data link layer receives packets and sends the data to the physical
layer in form of frames. Elementary Data Link Protocols ensure reliability over
a network during the transmission of frames. The Elementary data link
protocols help the data link layer solve problems such as frame loss or damage
and flow control.

 The data link layer adds a header and trailer to the packet that makes up
the frame. In the frame field, it contains an error detection method such as
a checksum. Therefore, after adding the control information of the data
link layer in the header and the checksum to the trailer, it is sent to the
receiver.
 When the receiver receives the frame, it calculates the checksum and
compares it with the sender’s checksum.
 If the checksum value matches, then the receiver’s data link layer will
allow the frame to be sent to the network layer, otherwise, it sends
acknowledgement to the sender that the frame has been damaged.
 But when the process of sending a frame is taking place over a channel, a
protocol is used, which defines the time limit for sending and receiving
the frame.
 As soon as the sender sends a frame, the timer will start, and it will wait
for some time to receive an acknowledgment from the receiver that it has
received the frame.
 If the sender does not receive the acknowledgment within the given time,
the sender will resend the frame to the receiver. This process is done by
the Elementary data link protocols.

Elementary Data Link Protocols

When we study the various Elementary data link protocols, we will assume that
there is an unreliable channel over which frame loss occurs during transmission.
To recover frames lost during transmission, the sender starts the internal clock
each time a frame is sent. The sender will wait for some time, and if no reply is
received within the predetermined time, the clock times out, and the data link
layer will receive an interrupt signal.

 There are some methods or procedures executed by the protocol that turn
the timer on and off, respectively. The clock is reset only after an interval
is reached.

 Since the Elementary data link protocol is used at the data link layer, the
data link layer also controls access to the network layer. The data link
layer decides when to enable the network layer to send packets to prevent
it from swamping packets with them.
There are 3 types of Elementary Data Link Protocols.

The above diagram shows that simplex protocol, a simplex stop-and-wait


protocol for a noiseless channel, and a simplex stop-and-wait protocol for a
noisy channel are the Elementary data link protocols.

Simplex Protocol

A simplex protocol is a simple protocol because it does not worry about


whether something is going right or wrong on the channel.

 In this protocol, data is transmitted in only one direction. Therefore it is


unidirectional.

 No matter what is happening in the network, the sender and receiver are
always ready to communicate. So they also ignore the delay in
processing.
 This protocol is just a consideration so that there is infinite buffer space
available on the sender and receiver.

 It is an unrealistic protocol, or you can say it is an unrestricted protocol.

 In this protocol, the channel used between layer-2 of the sender and
receiver never discards or damages the frame during communication.

Working of Simplex Protocol

In protocol, two entities are sender and receiver, who communicate with each
other over a channel. The sender process and receiver process are running at the
data link layer of the sender’s machine and the receiver’s machine, respectively.
Sequence number and acknowledgment number are not used. Only the
undamaged frame arrival process is going on.

The diagram below explains the simplex protocol.


 As you can see in the diagram, the direction of communication is in only
one direction. The sender is sending the data over the line as fast as
possible. The sender’s machine fetches packets from the network layer,
creates frames, and sends the frames over the line.

 On the other hand, the receiver is waiting to receive the frame. The frame
comes from the sender, so the receiver will take the frame that comes into
the hardware buffer and send it to the network layer.

 After the frame is sent to the network layer, the receiver’s data link layer
will sit back to wait for the next frame.
Because this protocol is unrealistic and unrestricted, it has no flow control and
error control restrictions. Here, no frame is lost during transmission, and hence
no field of the frame is required to control the flow of data and detect the error.

Simplex Stop-and-Wait Protocol for Noiseless Channel

In a stop-and-wait protocol, the sender stops after sending a frame to the


receiver and waits for an acknowledgment before sending another frame.

 We here assume a noiseless channel that is error-free on which the frame


is never damaged or corrupted. Here the channel is error-free but does not
control the flow of data.

 Using the simplex stop-and-wait protocol, we can prevent the sender


from flooding the receiver with frames faster than the receiver can
process them.

 To prevent flooding on the receiver side, one solution is to enable the


receiver to process frames back-to-back by adding a buffer of sufficient
size. We can enhance the processing capabilities of the receiver so that it
can quickly pass the received frame to the network layer. But it’s still not
a general solution.

 Common solutions for addressing flooding issues on the receiver side,


providing feedback to the sender to reduce the flow rate at the receiver.

 So that, in the simplex stop-and-wait protocol, the receiver sends a


dummy frame back to the sender after the packet is sent over the network
layer, asking the sender to send the next frame.

 Frames can be transmitted to or received from the sender or receiver, so


the simplex stop-and-wait protocol is bidirectional.
Working of Simplex Stop-and-Wait Protocol (Noiseless Channel)

As we got some basic idea about stop-and-wait protocol. Now, let’s see how the
Simplex stop-and-wait protocol handles flow control over a noiseless channel.

The diagram below explains the working of the simplex stop-and-wait protocol.

 As you can see in the above diagram that the sender is sending the frame
to the receiver. After sending the frame, the sender stops the transmission
and waits for the acknowledgment from the receiver.

 As soon as the receiver receives the frame, it opens it and sends it to the
network layer for further processing. Now, the receiver will create an
acknowledgment, which allows the sender to send the next frame.
 You can see that the communication is bidirectional, but they are using
half-duplex mode.

Simplex Stop-and-Wait Protocol for a Noisy Channel

Here, assume the general situation in which the sender and receiver on the
communication channel make an error during transmission. Frames can either
be damaged or lost completely during transmission.

 On a noisy channel, the receiver has only a limited buffer capacity and a
limited processing speed, so the protocol prevents the sender from
flooding the receiver with data too fast to handle it.

 In rare cases, the frame sent by the sender may be damaged in such a way
that the checksum is correct, causing this and all other protocols to fail.
To avoid this situation, a timer is added.

 Suppose, receiver’s acknowledgment is lost during transmission, the


sender will wait for acknowledgment for some time, and after the
timeout, the sender will send the frame again. This process is repeated
until the frame arrives and the acknowledgment is received from the
receiver.

 The data link layer is responsible for flow and error control. Therefore,
when the sender’s network layer transmits a series of packets to the data
link layer, the data link layer transmits the packets through the receiver’s
data link layer to the network layer.

 Here, the network layer has no functionality to check whether there is an


error in the packet, so the data link layer must guarantee to the network
layer that no transmission error occurs in the packet. Although duplicate
packets may arrive at the network layer, we can prevent this by using this
protocol.
Working of Simplex Stop-and-Wait Protocol for a Noisy Channel

As we have seen in the above section that the network layer does not have the
functionality to detect errors or duplication in the packet, so it is guaranteed by
the data link layer that there are no errors in the packet. But duplicate packets
can arrive at the network layer. So, let us understand this scenario with an
example.

The diagram below explains the working of the simplex stop-and-wait protocol
for a noisy channel.

 As you can see in the above diagram, the sender sends the packet in the
form of a frame to the receiver. When the receiver receives the frame, it
sends the frame in a packet format to the network layer.
 After frame-1 successfully reaches the receiver, the receiver will send an
acknowledgment to the sender. The sender will send the frame-2 after
receiving the acknowledgment from the receiver. But as shown in the
figure, frame-2 is lost during transmission. Therefore, the sender will
retransmit frame-2 after the timeout.

 Further, the receiver is sending an acknowledgment to the sender after


receiving frame-2. But the acknowledgment is completely lost during
transmission.

 The sender is waiting for the acknowledgment, but the timeout has
elapsed, and the acknowledgment has not been received. So the sender
will assume that the frame is lost or damaged, and it will send the same
frame again to the receiver.

 The receiver receives the same frame again. But how does the receiver
recognize that the packet of the frame is a duplicate or the original? So, it
will use the sequence number to identify whether the packet is duplicate
or new.

In this protocol, the only ambiguity is one frame and its next frame. Suppose
frame-n is lost or damaged, and the receiver didn’t receive the frame. Then, the
receiver will not even send the acknowledgment to the sender. So the sender
will keep sending frames again and again until the acknowledgment is received
in a given amount of time.

Some possibilities exist on this protocol as follows:

 If the packet is successfully received on the receiver side and the sender
receives a valid acknowledgment, the sender fetches the next packet from
the network layer and overwrites the previous packet in the buffer. Also,
it increases the sequence number of the packet to prevent duplication of
packets.
 If a damaged frame occurs or the clock timer has expired, the packet’s
buffer and sequence number will not change, and the sender will forward
the same or the next packet to the receiver.

 When the frame reaches the receiver successfully, the receiver will check
the sequence number to see if it is a duplicate. If not, it is accepted and
passed to the network layer, and an acknowledgment will be sent to the
sender.

You might also like