Professional Documents
Culture Documents
Untitled
Untitled
Untitled
COMPUTER NETWORKS
(https://www.javatpoint.com/multiple-access-protocols)
INTRODUCTION
Data refers to the raw facts that are collected while information refers to processed
data that enables us to take decisions.
Ex. When result of a particular test is declared it contains data of all students, when
you find the marks you have scored you have the information that lets you know
whether you have passed or failed.
DATA COMMUNICATION
The hardware part involves the sender and receiver devices and the intermediate
devices through which the data passes.
The software part involves certain rules which specify what is to be communicated,
how it is to be communicated and when. It is also called as a Protocol.
The effectiveness of any data communications system depends upon the following
four fundamental characteristics:
1. Delivery: The data should be delivered to the correct destination and correct
user.
2. Accuracy: The communication system should deliver the data accurately,
without introducing any errors. The data may get corrupted during
transmission affecting the accuracy of the delivered data.
3. Timeliness: Audio and Video data has to be delivered in a timely manner
without any delay; such a data delivery is called real time transmission of
data.
4. Jitter (a small irregular movement): It is the variation in the packet arrival
time. Uneven (Irregular) Jitter may affect the timeliness of data being
transmitted.
1. Message
Message is the information to be communicated by the sender to the
receiver.
2. Sender
The sender is any device that is capable of sending the data (message).
3. Receiver
The receiver is a device that the sender wants to communicate the data
(message).
4. Transmission Medium
It is the path by which the message travels from sender to receiver. It can be
wired or wireless and many subtypes in both.
5. Protocol
1. It is an agreed upon set of rules used by the sender and receiver to
communicate data.
2. A protocol is a set of rules that governs data communication.
3. A Protocol is a necessity in data communications without which the
communicating entities are like two persons trying to talk to each other in a
different language without know the other language.
DATA REPRESENTATION
There may be different forms in which data may be represented. Some of the forms
of data used in communications are as follows:
The pixels are represented in the form of bits. Depending upon the type of image
(black n white or color) each pixel would require different number of bits to
represent the value of a pixel.
The size of an image depends upon the number of pixels (also called resolution)
and the bit pattern used to indicate the value of each pixel.
Example: if an image is purely black and white (two color) each pixel can be
represented by a value either 0 or 1, so an image made up of 10 x 10 pixel elements
would require only 100 bits in memory to be stored.
L=2K
4. Audio: Data can also be in the form of sound which can be recorded and
broadcasted. Example: What we hear on the radio is a source of data or
information. Audio data is continuous, not discrete.
DATA FLOW
Devices communicate with each other by sending and receiving data. The data can
flow between the two devices in the following ways.
1. Simplex
2. Half Duplex
3. Full Duplex
1. Simplex
In half duplex both the stations can transmit as well as receive but not at the
same time.
When one device is sending other can only receive and viceversa (as shown
in figure above.)
Example: A walkie-talkie.
3. Full Duplex
In Full duplex mode, both stations can transmit and receive at the same
time.
Example: mobile phones
COMPUTER NETWORK
CATEGORIES OF NETWORK
Networks are categorized on the basis of their size. The three basic categories of
computer networks are:
Mesh Topology
In mesh topology each device is connected to every other device on the network
through a dedicated point-to-point link. When we say dedicated it means that the
link only carries data for the two connected devices only.
Lets say we have n devices in the network then each device must be connected
with (n-1) devices of the network. Number of links in a mesh topology of n devices
would be n(n-1)/2.
Star Topology
In star topology each device in the network is connected to a central device called
hub. Unlike Mesh topology, star topology doesn’t allow direct communication
between devices, a device must have to communicate through hub. If one device
wants to send data to other device, it has to first send the data to hub and then the
hub transmit that data to the designated device.
1. Less expensive because each device only need one I/O port and needs to be
connected with hub with one link.
2. Easier to install
3. Less amount of cables required because each device needs to be connected with
the hub only.
4. Robust, if one link fails, other links will work just fine.
5. Easy fault detection because the link can be easily identified.
1. If hub goes down everything goes down, none of the devices can work without
hub.
2. Hub requires more resources and regular maintenance because it is the central
system of star topology.
Bus Topology
In bus topology there is a main cable and all the devices are connected to this main
cable through drop lines. There is a device called tap that connects the drop line to
the main cable. Since all the data is transmitted over the main cable, there is a limit
of drop lines and the distance a main cable can have.
Ring Topology
In ring topology each device is connected with the two devices on either side of it.
There are two dedicated point to point links a device has with the devices on the
either side of it. This structure forms a ring thus it is known as ring topology. If a
device wants to send data to another device then it sends the data in one direction,
each device in ring topology has a repeater, if the received data is intended for
other device then repeater forwards this data until the intended device receives it.
1. Easy to install.
2. Managing is easier as to add or remove a device from the topology only two
links are required to be changed.
1. A link failure can fail the entire network as the signal will not travel forward due
to failure.
2. Data traffic issues, since all the data is circulating in a ring.
Hybrid topology
1. We can choose the topology based on the requirement for example, scalability is
our concern then we can use star topology instead of bus technology.
2. Scalable as we can further connect other computer networks with the existing
networks with different topologies.
PROTOCOL
1. A Protocol is one of the components of a data communications system.
Without protocol communication cannot occur. The sending device cannot
just send the data and expect the receiving device to receive and further
interpret it correctly.
2. When the sender sends a message it may consist of text, number, images,
etc. which are converted into bits and grouped into blocks to be transmitted
and often certain additional information called control information is also
added to help the receiver interpret the data.
3. For successful communication to occur, the sender and receiver must agree
upon certain rules called protocol.
4. A Protocol is defined as a set of rules that governs data communications.
5. A protocol defines what is to be communicated, how it is to be
communicated and when it is to be communicated.
There are mainly three key elements of a protocol, they are as follows:
Syntax
Semantics
Timing
Let's learn these elements in detail:
Syntax
Syntax refers to the structure or format of data and signal levels. It indicates how
to read the data in the form of bits or fields.
It also decides the order in which the data is presented to the receiver.
Example: A protocol might expect that the size of a data packet will be 16 bits.
In which, the first 4 bits are the sender’s address, the next 4 bits are the receiver’s
address, the next 4 bits are the check-sum bits, and the last 4 bits will contain the
message. So, every communication that is following that protocol should send 16-
bit data.
Semantics
Example: It interprets whether the bits of address identify the route to be taken or
the final destination of the message or something else.
Timing
Example: A sender can send the data at a speed of 100 Mbps, but the receiver
can consume it only at a speed of 20 Mbps, then there may be data losses or the
packets might get dropped. So, proper synchronization must be there between a
sender and a receiver.
Standards:
Standards are the set of rules for data communication that are needed for
exchange of information among devices. It is important to follow Standards
which are created by various Standard Organization like IEEE , ISO , ANSI etc.
Types of Standards :
Standards are of two types :
1. De Facto Standard.
2. De Jure Standard.
For example: Apple and Google are two companies which established their
own rules on their products which are different. Also they use some same
standard rules for manufacturing for their products.
For example : All the data communication standard protocols like SMTP , TCP
, IP , UDP etc. are important to follow the same when we needed them.
https://www.geeksforgeeks.org/layers-of-osi-model/
MAC address is the physical address, which uniquely identifies each device
on a given network. To make communication between two networked
devices, we need two addresses: IP address and MAC address. It is
assigned to the NIC (Network Interface card) of each device that can be
connected to the internet. It is globally unique; it means two devices cannot
have the same MAC address. It is represented in a hexadecimal format on
each device, such as 00:0a:95:9d:67:16.
2. The packet received from Network layer is further divided into frames
depending on the frame size of NIC(Network Interface Card). DLL also
encapsulates Sender and Receiver’s MAC address in the header.
7. Application Layer
The application layer is used by end-user software such as web browsers and email
clients.
6. Presentation Layer
It defines how two devices should encode, encrypt, and compress data so it is
received correctly on the other end.
The presentation layer takes any data transmitted by the application layer and
prepares it for transmission over the session layer.
5. Session Layer
It is responsible for opening sessions, ensuring they remain open and functional
while data is being transferred, and closing them when communication ends.
The session layer can also set checkpoints during a data transfer—if the session is
interrupted, devices can resume data transfer from the last checkpoint.
4. Transport Layer
The transport layer takes data transferred in the session layer and breaks it into
“segments” on the transmitting end.
The transport layer carries out flow control, sending data at a rate that matches the
connection speed of the receiving device, and error control, checking if data was
received incorrectly and if not, requesting it again.
3. Network Layer
The network layer has two main functions. One is breaking up segments into
network packets, and reassembling the packets on the receiving end. The other is
routing packets by discovering the best path across a physical network. The
network layer uses network addresses (typically Internet Protocol addresses) to
route packets to a destination node.
The data link layer establishes and terminates a connection between two
physically-connected nodes on a network. It breaks up packets into frames and
sends them from source to destination. This layer is composed of two parts—
Logical Link Control (LLC), which identifies network protocols, performs error
checking and synchronizes frames, and Media Access Control (MAC) which uses
MAC addresses to connect devices and define permissions to transmit and receive
data.
1. Physical Layer
The physical layer is responsible for the physical cable or wireless connection
between network nodes. It defines the connector, the electrical cable or wireless
technology connecting the devices, and is responsible for transmission of the raw
data, which is simply a series of 0s and 1s, while taking care of bit rate control.
1. The OSI reference model was the first communication model and was
termed as general-purpose model because of its ability to fit in any type
of network but without fitting the protocols in. Due to its inability to fit
protocols, TCP/IP reference model which is commonly known as
Internet Model was developed in year 1983 by US Military Wing called
ARPANET.
2. TCP/IP stands for Transmission Control Protocol with the help of
which, protocol implementation over the network can be achieved.
3. The TCP/IP model also has a layered architecture which allows easy
data communication along with the facility of integrating multiple
protocols. The layout remains similar to OSI Model but the number of
layer, their functionalities and properties got changed.
4. This Internet Model(TCP/IP) comprises of only four layers as compared
to seven layers of OSI Model. These four layers are generated by
combining the layers of OSI model internally so that protocols can be
implemented. These layers have fixed positions too and their positions
cannot be altered.
5. Application Layer, Transport Layer, Internet Layer and Network
Access Layers are the four layers of TCP/IP Model.
o The Transport Layer performs the same functions and have similar
features as that in OSI Model. The functionality of Transport Layer is
to provide end to end data transfer by using the technique of connection
oriented services between sender and receiver with the help of various
protocols.
The Application Layer resides on the top of the TCP/IP reference model as
line in OSI Model. The functionality of Application Layer of
TCP/IP reference model is to provide interface between users and the
applications. In some cases depending upon the requirements, it can
perform the functions of Session Layer(to provide sessions) and
Presentation Layer(data representation).
Application Layer = Session Layer + Presentation Layer + Application
Layer .
In the OSI model, the transport layer The transport layer does not provide
provides a guarantee for the delivery of the surety for the delivery of packets.
the packets. But still, we can say that it is a
reliable model.
In this model, the session and In this model, the session and
presentation layers are separated, i.e., presentation layer are not different
both the layers are different. layers. Both layers are included in
the application layer.
In this model, the network layer provides The network layer provides only
both connection-oriented and connectionless service.
connectionless service.
Protocols in the OSI model are hidden In this model, the protocol cannot be
and can be easily replaced when the easily replaced.
technology changes.
The usage of this model is very low. This model is highly used.
So a gateway is basically a device that is used for the communication among the
networks which have a different set of protocols and is responsible for the
conversion of one protocol into the other. For any kind of workplace, the gateway
is a computer system which is responsible for routing the traffic from the main
workstation to outside network.
For homes, it is responsible for giving the access to the internet thus acting as an
internet service provider (ISP).
S.NO. Router Gateway
Wired LAN
LAN stands for Local Area Network. It can be described as a collection of network
devices in a specific location, and all of them are connected via switches or routers,
which helps in the transmission of data. Each network device uses a cable to
connect itself to the switch or router.
Wireless LAN
WLAN stands for Wireless Local Area Network. This network type enables the
transfer of data with the help of wireless transmitters and receivers. This does not
use the typical data transfer done using the cables. WLANs are used in areas that
require a large number of devices to connect to the internet at the same time.
WLAN vs LAN
The difference between WLAN and LAN is that WLAN stands for Wireless Local
Area Network and LAN stands for Local Area Network. Both are network
providers offering network services with varying costs, performance, and security
levels.
Parameters of
WLAN LAN
Comparison
Types of Errors
In this error detection technique, a redundant bit called parity bit is appended to
every data unit so that total number of 1's in the unit (including parity bit) becomes
even. The system now transmits entire extended unit across the network link. At
the receiver, all eight received bits are checked through even parity checking
function. If it counts even 1's data unit passes. If it counts odd number of 1's, it
means error has been introduced in the data somewhere. Hence receiver rejects the
whole data unit. Similar way odd parity VRC can also be implemented. In this
method, total number of 1's should be odd before transmission.
Parity Check
One extra bit is sent along with the original bits to make number of 1s either even
in case of even parity, or odd in case of odd parity.
The sender while creating a frame counts the number of 1s in it. For example, if
even parity is used and number of 1s is even then one bit with value 0 is added.
This way number of 1s remains even.If the number of 1s is odd, to make it even a
bit with value 1 is added.
The receiver simply counts the number of 1s in a frame. If the count of 1s is even
and even parity is used, the frame is considered to be not-corrupted and is
accepted. If the count of 1s is odd and odd parity is used, the frame is still not
corrupted.
Example:
If a block of 32 bits is to be transmitted, it is divided into matrix of four rows and
eight columns which as shown in the following figure:
In this matrix of bits, a parity bit (odd or even) is calculated for each column. It
means 32 bits data plus 8 redundant bits are transmitted to receiver. Whenever
data reaches at the destination, receiver uses LRC to detect error in data.
Advantage :
LRC is used to detect burst errors.
Example : Suppose 32 bit data plus LRC that was being transmitted is hit by a
burst error of length 5 and some bits are corrupted as shown in the following
figure :
Figure : Burst error & LRC
The LRC received by the destination does not match with newly corrupted LRC.
The destination comes to know that the data is erroneous, so it discards the data.
Disadvantage :
The main problem with LRC is that, it is not able to detect error if two bits in a
data unit are damaged and two bits in exactly the same position in other data unit
are also damaged.
CRC is a different approach to detect if the received frame contains valid data.
This technique involves binary division of the data bits being sent. The divisor is
generated using polynomials. The sender performs a division operation on the bits
being sent and calculates the remainder. Before sending the actual bits, the sender
adds the remainder at the end of the actual bits. Actual data bits plus the
remainder is called a codeword. The sender transmits data bits as codewords.
At the other end, the receiver performs division operation on codewords using the
same CRC divisor. If the remainder contains all zeros the data bits are accepted,
otherwise it is considered as there some data corruption occurred in transit.
4. Check sum
This is a block code method where a checksum is created based on the data values
in the data blocks to be transmitted using some algorithm and appended to the data.
When the receiver gets this data, a new checksum is calculated and compared with
the existing checksum. A non-match indicates an error.
Error Detection by Checksums
For error detection by checksums, data is divided into fixed sized frames or
segments.
Sender’s End − The sender adds the segments using 1’s complement
arithmetic to get the sum. It then complements the sum to get the checksum
and sends it along with the data frames.
Receiver’s End − The receiver adds the incoming segments along with the
checksum using 1’s complement arithmetic to get the sum and then
complements it.
If the result is zero, the received frames are accepted; otherwise they are discarded.
Example
Suppose that the sender wants to send 4 frames each of 8 bits, where the frames are
11001100, 10101010, 11110000 and 11000011.
The sender adds the bits using 1s complement arithmetic. While adding two
numbers using 1s complement arithmetic, if there is a carry over, it is added to the
sum.
After adding all the 4 frames, the sender complements the sum to get the
checksum, 11010011, and sends it along with the data frames.
The receiver performs 1s complement arithmetic sum of all the frames including
the checksum. The result is complemented and found to be 0. Hence, the receiver
assumes that no error has occurred.
Error Correction
Error Correction codes are used to detect and correct the errors when data is
transmitted from the sender to the receiver.
In order to detect or correct the errors, there is a need to send some extra bits along
with the data. These extra bits are commonly known as Redundant bits.
As we had learned in the previous tutorial that original data is divided into
segments of k bits; it is referred to as dataword. When we add r redundant bits to
each block in order to make the length;n=k+r then it is referred to as Codeword.
6.1M
A single additional bit can detect the error, but cannot correct it.
For correcting the errors, one has to know the exact position of the error. For
example, If we want to calculate a single-bit error, the error correction code will
determine which one of seven bits is in error. To achieve this, we have to add some
additional redundant bits. Java Program for BeginnersHighest Salary in SQL
Suppose r is the number of redundant bits and d is the total number of the data bits.
The number of redundant bits r can be calculated by using the formula:
2r>=d+r+1
The value of r is calculated by using the above formula. For example, if the value
of d is 4, then the possible smallest value that satisfies the above relation would be
3.
The number of redundant bits is 3. The three bits are represented by r1, r2, r4. The
position of the redundant bits is calculated with corresponds to the raised power of
2. Therefore, their corresponding positions are 1, 21, 22.
1. The position of r1 = 1
2. The position of r2 = 2
3. The position of r4 = 4
The r1 bit is calculated by performing a parity check on the bit positions whose
binary representation includes 1 in the first position.
We observe from the above figure that the bit positions that includes 1 in the first
position are 1, 3, 5, 7. Now, we perform the even-parity check at these bit
positions. The total number of 1 at these bit positions corresponding to r1 is even,
therefore, the value of the r1 bit is 0.
Determining r2 bit
The r2 bit is calculated by performing a parity check on the bit positions whose
binary representation includes 1 in the second position.
We observe from the above figure that the bit positions that includes 1 in the
second position are 2, 3, 6, 7. Now, we perform the even-parity check at these bit
positions. The total number of 1 at these bit positions corresponding to r2 is odd,
therefore, the value of the r2 bit is 1.
Determining r4 bit
The r4 bit is calculated by performing a parity check on the bit positions whose
binary representation includes 1 in the third position.
We observe from the above figure that the bit positions that includes 1 in the third
position are 4, 5, 6, 7. Now, we perform the even-parity check at these bit
positions. The total number of 1 at these bit positions corresponding to r4 is even,
therefore, the value of the r4 bit is 0.
Suppose the 4th bit is changed from 0 to 1 at the receiving end, then parity bits are
recalculated.
R1 bit
We observe from the above figure that the binary representation of r1 is 1100.
Now, we perform the even-parity check, the total number of 1s appearing in the r1
bit is an even number. Therefore, the value of r1 is 0.
R2 bit
R4 bit
We observe from the above figure that the binary representation of r4 is 1011.
Now, we perform the even-parity check, the total number of 1s appearing in the r4
bit is an odd number. Therefore, the value of r4 is 1.
o The binary representation of redundant bits, i.e., r4r2r1 is 100, and its
corresponding decimal value is 4. Therefore, the error occurs in a 4th bit
position. The bit value must be changed from 1 to 0 to correct the error.
Flow Control and Error Control
Stop and Wait Protocol
Noiseless channels are those channels which do not degrade the quality of data
(loss of data) during transmission.
Sliding Window protocol
The sliding window is a technique for sending multiple frames at a time. It controls
the data packets between the two devices where reliable and gradual delivery of
data frames is needed. It is also used in TCP.
In this technique, each frame has sent from the sequence number. The sequence
numbers are used to find the missing data in the receiver end. The purpose of the
sliding window technique is to avoid duplicate data, so it uses the sequence
number.
Go-back-N-ARQ Protocol
Go-Back-N ARQ protocol is also known as Go-Back-N Automatic Repeat
Request. It is a data link layer protocol that uses a sliding window method. In this,
if any frame is corrupted or lost, all subsequent frames have to be sent again.
The size of the sender window is N in this protocol. For example, Go-Back-8, the
size of the sender window, will be 8.
If the receiver receives a corrupted frame, it cancels it. The receiver does not
accept a corrupted frame. When the timer expires, the sender sends the correct
frame again. The design of the Go-Back-N ARQ protocol is shown below.
Selective-Repeat ARQ Protocol
Selective Repeat ARQ is also known as the Selective Repeat Automatic Repeat
Request. It is a data link layer protocol that uses a sliding window method. The
Go-back-N ARQ protocol works well if it has fewer errors. But if there is a lot of
error in the frame, lots of bandwidth loss in sending the frames again. So, we use
the Selective Repeat ARQ protocol. In this protocol, the size of the sender window
is always equal to the size of the receiver window. The size of the sliding window
is always greater than 1.
If the receiver receives a corrupt frame, it does not directly discard it. It sends a
negative acknowledgment to the sender. The sender sends that frame again as soon
as on the receiving negative acknowledgment. There is no waiting for any time-out
to send that frame. The design of the Selective Repeat ARQ protocol is shown
below.
Selective Repeat ARQ
Selective Repeat ARQ is also known as the Selective Repeat Automatic Repeat
Request. It is a data link layer protocol that uses a sliding window method. The
Go-back-N ARQ protocol works well if it has fewer errors. But if there is a lot of
error in the frame, lots of bandwidth loss in sending the frames again. So, we use
the Selective Repeat ARQ protocol. In this protocol, the size of the sender window
is always equal to the size of the receiver window. The size of the sliding window
is always greater than 1.
If the receiver receives a corrupt frame, it does not directly discard it. It sends a
negative acknowledgment to the sender. The sender sends that frame again as soon
as on the receiving negative acknowledgment. There is no waiting for any time-out
to send that frame. The design of the Selective Repeat ARQ protocol is shown
below.
Difference between the Go-Back-N ARQ and Selective Repeat ARQ
If a frame is corrupted or lost in it, In this, only the frame is sent again, which
all subsequent frames have to be is corrupted or lost.
sent again.
If it has a high error rate, it wastes There is a loss of low bandwidth.
a lot of bandwidth.
It is less complex. It is more complex because it has to do
sorting and searching as well. And it also
requires more storage.
It does not require sorting. In this, sorting is done to get the frames in
the correct order.
It does not require searching. The search operation is performed in it.
It is used more. It is used less because it is more complex.
When a sender and receiver have a dedicated link to transmit data packets, the data
link control is enough to handle the channel. Suppose there is no dedicated path to
communicate or transfer the data between two devices. In that case, multiple
stations access the channel and simultaneously transmit the data over the channel.
It may create collision and cross talk. Hence, the multiple access protocol is
required to reduce the collision and avoid crosstalk between the channels.
For example, suppose that there is a classroom full of students. When a teacher
asks a question, all the students (small channels) in the class start answering the
question at the same time (transferring the data simultaneously). All the students
respond at the same time due to which data is overlap or data lost. Therefore it is
the responsibility of a teacher (multiple access protocol) to manage the students
and make them one answer.
Following are the types of multiple access protocol that is subdivided into the
different process as:
A. Random Access Protocol
In this protocol, all the station has the equal priority to send the data over a
channel. In random access protocol, one or more stations cannot depend on another
station and any station control another station. Depending on the channel's state
(idle or busy), each station transmits the data frame. However, if more than one
station sends the data over a channel, there may be a collision or data conflict. Due
to the collision, the data frame packets may be lost or changed. And hence, it does
not receive by the receiver end.
o ALOHA
o CSMA
o CSMA/CD
o CSMA/CA
ALOHA
It is designed for wireless LAN (Local Area Network) but can also be used in a
shared medium to transmit data. Using this method, any station can transmit data
across a network simultaneously when a data frameset is available for
transmission.
Aloha Rules
Pure Aloha
Whenever data is available for sending over a channel at stations, we use Pure
Aloha. In pure Aloha, when each station transmits data to a channel without
checking whether the channel is idle or not, the chances of collision may occur,
and the data frame can be lost. When any station transmits the data frame to a
channel, the pure Aloha waits for the receiver's acknowledgment. If it does not
acknowledge the receiver end within the specified time, the station waits for a
random amount of time, called the backoff time (Tb). And the station may assume
the frame has been lost or destroyed. Therefore, it retransmits the frame until all
the data are successfully transmitted to the receiver.
The slotted Aloha is designed to overcome the pure Aloha's efficiency because
pure Aloha has a very high possibility of frame hitting. In slotted Aloha, the shared
channel is divided into a fixed time interval called slots. So that, if a station wants
to send a frame to a shared channel, the frame can only be sent at the beginning of
the slot, and only one frame is allowed to be sent to each slot. And if the stations
are unable to send data to the beginning of the slot, the station will have to wait
until the beginning of the slot for the next time. However, the possibility of a
collision remains when trying to send a frame at the beginning of two or more
station time slot.
CSMA (Carrier Sense Multiple Access)
1-Persistent: In the 1-Persistent mode of CSMA that defines each node, first sense
the shared channel and if the channel is idle, it immediately sends the data. Else it
must wait and keep track of the status of the channel to be idle and broadcast the
frame unconditionally as soon as the channel is idle.
Algorithms
For example, as soon as a node receives a packet to transmit across the network, it
will check to ensure the channel is clear and no other node is transmitting at the
same time. If the network channel is idle, the packet is sent.
CSMA/CA checks that channels are clear before sending data packets across a
network.
If the channel is not clear, the node waits for a randomly chosen period of time --
in microseconds -- and then checks again to see if the channel is clear. This is
called the backoff factor and is counted down using a backoff counter.
If the channel is idle when the backoff counter reaches zero, the node transmits the
packet. If the channel is not clear when the backoff counter reaches zero, the
backoff factor will reset itself and repeat the process.
When the receiver gets the packet frame intact, it transmits an acknowledgment
(ACK) to the sender.
NETWORK LAYER
Switching techniques
In large networks, there can be multiple paths from sender to receiver. The
switching technique will decide the best route for data transmission.
Circuit Switching
o Circuit establishment
o Data transfer
o Circuit Disconnect
o Crossbar Switch
o Multistage Switch
Crossbar Switch
The Crossbar switch is a switch that has n input lines and n output lines. The
crossbar switch has n2 intersection points known as crosspoints.
Multistage Switch
o Multistage Switch is made by splitting the crossbar switch into the smaller
units and then interconnecting them.
o It reduces the number of crosspoints.
o If one path fails, then there will be an availability of another path.
o Once the dedicated path is established, the only delay occurs in the speed of
data transmission.
o It takes a long time to establish a connection approx 10 seconds during
which no data can be transmitted.
o It is more expensive than other switching techniques as a dedicated path is
required for each connection.
o It is inefficient to use because once the path is established and no data is
transferred, then the capacity of the path is wasted.
o In this case, the connection is dedicated therefore no other data can be
transferred even if the channel is free.
Message Switching
o Message Switching is a switching technique in which a message is
transferred as a complete unit and routed through intermediate nodes at
which it is stored and forwarded.
o In Message Switching technique, there is no establishment of a dedicated
path between the sender and receiver.
o The destination address is appended to the message. Message Switching
provides a dynamic routing as the message is routed through the
intermediate nodes based on the information available in the message.
o Message switches are programmed in such a way so that they can provide
the most efficient routes.
o Each and every node stores the entire message and then forward it to the
next node. This type of network is known as store and forward network.
o Message switching treats each message as an independent entity.
o Data channels are shared among the communicating devices that improve
the efficiency of using available bandwidth.
o Traffic congestion can be reduced because the message is temporarily stored
in the nodes.
o Message priority can be used to manage the network.
o The size of the message which is sent over the network can be varied.
Therefore, it supports the data of unlimited size.
o In the above diagram, A and B are the sender and receiver respectively. 1
and 2 are the nodes.
o Call request and call accept packets are used to establish a connection
between the sender and receiver.
o When a route is established, data will be transferred.
o After transmission of data, an acknowledgment signal is sent by the receiver
that the message has been received.
o If the user wants to terminate the connection, a clear signal is sent for the
termination.
Node takes routing decisions to Node does not take any routing decision.
forward the packets.
Congestion cannot occur as all the Congestion can occur when the node is
packets travel in different busy, and it does not allow other packets to
directions. pass through.
What is IP?
An IP address consists of two parts, i.e., the first one is a network address, and the
other one is a host address.
o IPv4
o IPv6
What is IPv4?
IPv4 is a version 4 of IP. It is a current version and the most commonly used IP
address. It is a 32-bit address written in four numbers separated by 'dot', i.e.,
periods. This address is unique for each device.
For example, 66.94.29.13
The above example represents the IP address in which each group of numbers
separated by periods is called an Octet. Each number in an octet is in the range
from 0-255. This address can produce 4,294,967,296 possible unique addresses.
Each bit in an octet can be either 1 or 0. If the bit the 1, then the number it
represents will count, and if the bit is 0, then the number it represents does not
count.
Now, we will see how to obtain the binary representation of the above IP address,
i.e., 66.94.29.13
To obtain 94, we put 1 under 64, 16, 8, 4, and 2 as the sum of these numbers is
equal to 94, and the remaining bits will be zero. Therefore, the binary bit version of
94 is 01011110.
To obtain 29, we put 1 under 16, 8, 4, and 1 as the sum of these numbers is equal
to 29, and the remaining bits will be zero. Therefore, the binary bit version of 29 is
00011101.
Drawback of IPv4
Currently, the population of the world is 7.6 billion. Every user is having more
than one device connected with the internet, and private companies also rely on the
internet. As we know that IPv4 produces 4 billion addresses, which are not enough
for each device connected to the internet on a planet. Although the various
techniques were invented, such as variable- length mask, network address
translation, port address translation, classes, inter-domain translation, to conserve
the bandwidth of IP address and slow down the depletion of an IP address. In these
techniques, public IP is converted into a private IP due to which the user having
public IP can also use the internet. But still, this was not so efficient, so it gave rise
to the development of the next generation of IP addresses, i.e., IPv6.
What is IPv6?
IPv4 produces 4 billion addresses, and the developers think that these addresses are
enough, but they were wrong. IPv6 is the next generation of IP addresses. The
main difference between IPv4 and IPv6 is the address size of IP addresses. The
IPv4 is a 32-bit address, whereas IPv6 is a 128-bit hexadecimal address. IPv6
provides a large address space, and it contains a simple header as compared to
IPv4.
It provides transition strategies that convert IPv4 into IPv6, and these strategies are
as follows:
o Dual stacking: It allows us to have both the versions, i.e., IPv4 and IPv6, on
the same device.
o Tunneling: In this approach, all the users have IPv6 communicates with an
IPv4 network to reach IPv6.
o Network Address Translation: The translation allows the communication
between the hosts having a different version of IP.
This hexadecimal address contains both numbers and alphabets. Due to the usage
of both the numbers and alphabets, IPv6 is capable of producing over 340
undecillion (3.4*1038) addresses.
IPv6 is a 128-bit hexadecimal address made up of 8 sets of 16 bits each, and these
8 sets are separated by a colon. In IPv6, each hexadecimal character represents 4
bits. So, we need to convert 4 bits to a hexadecimal number at a time
Address format
The above diagram shows the address format of IPv4 and IPv6. An IPv4 is a 32-bit
decimal address. It contains 4 octets or fields separated by 'dot', and each field is 8-
bit in size. The number that each field contains should be in the range of 0-255.
Whereas an IPv6 is a 128-bit hexadecimal address. It contains 8 fields separated by
a colon, and each field is 16-bit in size.
Ipv4 Ipv6
Packet flow It does not provide any It uses flow label field in
identification mechanism for packet flow the header for the packet
identification. flow identification.
Before sending the IP packet, the MAC address of destination must be known. If
not so, then sender broadcasts the ARP-discovery packet requesting the MAC
address of intended destination. Since ARP-discovery is broadcast, every host
inside that network will get this message but the packet will be discarded by
everyone except that intended receiver host whose IP is associated. Now, this
receiver will send a unicast packet with its MAC address (ARP-reply) to the
sender of ARP-discovery packet. After the original sender receives the ARP-
reply, it updates ARP-cache and start sending unicast message to the destination.
2. Reverse Address Resolution Protocol (RARP) –
A special host configured inside the local area network, called as RARP-server is
responsible to reply for these kind of broadcast packets. Now the RARP server
attempt to find out the entry in IP to MAC address mapping table. If any entry
matches in table, RARP server send the response packet to the requesting device
along with IP address.
LAN technologies like Ethernet, Ethernet II, Token Ring and Fiber
Distributed Data Interface (FDDI) support the Address Resolution Protocol.
RARP is not being used in today’s networks. Because we have much great
featured protocols like BOOTP (Bootstrap Protocol) and DHCP( Dynamic
Host Configuration Protocol).
DHCP (Dynamic Host Configuration Protocol)
DHCP is also used to configure the proper subnet mask, default gateway
and DNS server information on the node or device.
Switching Techniques:
Logical addressing:
(https://www.youtube.com/watch?v=zFyl_zaRYuQ)
Address format of IPv4
The above diagram shows the address format of IPv4 and IPv6. An IPv4 is a 32-bit
decimal address. It contains 4 octets or fields separated by 'dot', and each field is 8-
bit in size. The number that each field contains should be in the range of 0-255.
Whereas an IPv6 is a 128-bit hexadecimal address. It contains 8 fields separated by
a colon, and each field is 16-bit in size.
Differences between IPv4 and IPv6
IPv4 IPv6
Packet flow It does not provide any It uses flow label field in
identification mechanism for packet flow the header for the packet
identification. flow identification.
Classful Addressing
o Class A
o Class B
o Class C
o Class D
o Class E
In the above diagram, we observe that each class have a specific range of IP
addresses. The class of IP address is used to determine the number of bits used in a
class and number of networks and hosts available in the class.
Class A
In Class A, the first bit in higher order bits of the first octet is always set to 0 and
the remaining 7 bits determine the network ID. The 24 bits determine the host ID
in any network.
In Class B, the higher order bits of the first octet is always set to 01, and the
remaining14 bits determine the network ID. The other 16 bits determine the Host
ID.
Class C
In Class C, the higher order bits of the first octet is always set to 110, and the
remaining 21 bits determine the network ID. The 8 bits of the host ID determine
the host in a network.
Class D
In Class D, an IP address is reserved for multicast addresses. It does not possess
subnetting. The higher order bits of the first octet is always set to 1110, and the
remaining bits determines the host ID in any network.
Class E
In Class E, an IP address is used for the future use or for the research and
development purposes. It does not possess any subnetting. The higher order bits of
the first octet is always set to 1111, and the remaining bits determines the host ID
in any network.
Before sending the IP packet, the MAC address of destination must be known. If
not so, then sender broadcasts the ARP-discovery packet requesting the MAC
address of intended destination. Since ARP-discovery is broadcast, every host
inside that network will get this message but the packet will be discarded by
everyone except that intended receiver host whose IP is associated. Now, this
receiver will send a unicast packet with its MAC address (ARP-reply) to the
sender of ARP-discovery packet. After the original sender receives the ARP-
reply, it updates ARP-cache and start sending unicast message to the destination.
(https://www.youtube.com/watch?v=-jjMVbxyuGY)
Reverse Address Resolution Protocol (RARP) –
3.Full- Duplex Communication: SCTP provides full-duplex service ( the data can
flow in both directions at the same time).
Step1: The two SCTPs establish the connection with each other.
Step2: Once the connection is established, the data gets exchanged in both
the directions.
Features of SCTP
3. Packets: In SCTP, the data is carried out in the form of data chunks and control
information is carried as control chunks. Data chunks and control chunks are
packed together in the packet.
1. Reliability
If a packet gets lost or acknowledgement is not received (at sender), the re-
transmission of data will be needed. This decreases the reliability.
The importance of the reliability can differ according to the application.
For example:
E- mail and file transfer need to have a reliable transmission as compared to
that of an audio conferencing.
2. Delay
Delay of a message from source to destination is a very important
characteristic. However, delay can be tolerated differently by the different
applications.
For example:
The time delay cannot be tolerated in audio conferencing (needs a minimum
time delay), while the time delay in the e-mail or file transfer has less
importance.
3. Jitter
The jitter is the variation in the packet delay.
If the difference between delays is large, then it is called as high jitter. On the
contrary, if the difference between delays is small, it is known as low jitter.
Example:
Case1: If 3 packets are sent at times 0, 1, 2 and received at 10, 11, 12. Here,
the delay is same for all packets and it is acceptable for the telephonic
conversation.
Case2: If 3 packets 0, 1, 2 are sent and received at 31, 34, 39, so the delay is
different for all packets. In this case, the time delay is not acceptable for the
telephonic conversation.
4. Bandwidth
Different applications need the different bandwidth.
For example:
Video conferencing needs more bandwidth in comparison to that of sending an
e-mail.
Techniques to Improve QoS
Some techniques that can be used to improve the quality of service. The four
common methods: scheduling, traffic shaping, admission control, and resource
reservation.
a. Scheduling
Packets from different flows arrive at a switch or router for processing. A good
scheduling technique treats the different flows in a fair and appropriate manner.
Several scheduling techniques are designed to improve the quality of service. We
discuss three of them here: FIFO queuing, priority queuing, and weighted fair
queuing.
i. FIFO Queuing
In first-in, first-out (FIFO) queuing, packets wait in a buffer (queue) until the node
(router or switch) is ready to process them. If the average arrival rate is higher than
the average processing rate, the queue will fill up and new packets will be
discarded. A FIFO queue is familiar to those who have had to wait for a bus at a
bus stop.
iii. Weighted Fair Queuing
A better scheduling method is weighted fair queuing. In this technique, the packets
are still assigned to different classes and admitted to different queues. The queues,
however, are weighted based on the priority of the queues; higher priority means a
higher weight. The system processes packets in each queue in a round-robin
fashion with the number of packets selected from each queue based on the
corresponding weight. For example, if the weights are 3, 2, and 1, three packets are
processed from the first queue, two from the second queue, and one from the third
queue. If the system does not impose priority on the classes, all weights can be
equal. In this way, we have fair queuing with priority. Figure 4.33 shows the
technique with three classes.
b. Traffic Shaping
Traffic shaping is a mechanism to control the amount and the rate of the traffic sent
to the network. Two techniques can shape traffic: leaky bucket and token bucket
i. Leaky Bucket
If a bucket has a small hole at the bottom, the water leaks from the bucket at a
constant rate as long as there is water in the bucket. The rate at which the water
leaks does not depend on the rate at which the water is input to the bucket unless
the bucket is empty. The input rate can vary, but the output rate remains constant.
Similarly, in networking, a technique called leaky bucket can smooth out bursty
traffic. Bursty chunks are stored in the bucket and sent out at an average rate.
Figure 4.34 shows a leaky bucket and its effects.
In the figure, we assume that the network has committed a bandwidth of 3 Mbps
for a host. The use of the leaky bucket shapes the input traffic to make it conform
to this commitment. In Figure 4.34 the host sends a burst of data at a rate of 12
Mbps for 2 s, for a total of 24 Mbits of data. The host is silent for 5 s and then
sends data at a rate of 2 Mbps for 3 s, for a total of 6 Mbits of data. In all, the host
has sent 30 Mbits of data in lOs. The leaky bucket smooth’s the traffic by sending
out data at a rate of 3 Mbps during the same 10 s.
The token bucket can easily be implemented with a counter. The token is
initialized to zero. Each time a token is added, the counter is incremented by 1.
Each time a unit of data is sent, the counter is decremented by 1. When the counter
is zero, the host cannot send data.
The token bucket allows bursty traffic at a regulated maximum rate.
Combining Token Bucket and Leaky Bucket
The two techniques can be combined to credit an idle host and at the same time
regulate the traffic. The leaky bucket is applied after the token bucket; the rate of
the leaky bucket needs to be higher than the rate of tokens dropped in the bucket.
c. Resource Reservation
A flow of data needs resources such as a buffer, bandwidth, CPU time, and so on.
The quality of service is improved if these resources are reserved beforehand. We
discuss in this section one QoS model called Integrated Services, which depends
heavily on resource reservation to improve the quality of service.
d. Admission Control
Admission control refers to the mechanism used by a router, or a switch, to accept
or reject a flow based on predefined parameters called flow specifications. Before a
router accepts a flow for processing, it checks the flow specifications to see if its
capacity (in terms of bandwidth, buffer size, CPU speed, etc.) and its previous
commitments to other flows can handle the new flow.
o Public key
o Private key
The Public key is used for encryption, and the Private Key is used for decryption.
Decryption cannot be done using a public key. The two keys are linked, but the
private key cannot be derived from the public key. The public key is well known,
but the private key is secret and it is known only to the user who owns the key. It
means that everybody can send a message to the user using user's public key. But
only the user can decrypt the message using his private key.
This example shows how we can encrypt plaintext 9 using the RSA public-key
encryption algorithm. This example uses prime numbers 7 and 11 to generate the
public and private keys.
Explanation:
p=7
q = 11
First, we calculate
n=pxq
n = 7 x 11
n = 77
Second, we calculate
φ (n) = (p - 1) x (q-1)
φ (n) = (7 - 1) x (11 - 1)
φ (n) = 6 x 10
φ (n) = 60
To find ciphertext from the plain text following formula is used to get ciphertext C.
C = me mod n
C = 97 mod 77
C = 37
Step 5: The private key is <d, n>. To determine the private key, we use the
following formula d such that:
Step 6: A ciphertext message c is decrypted using private key <d, n>. To calculate
plain text m from the ciphertext c following formula is used to get plain text m.
m = cd mod n
m = 3743 mod 77
m=9
Example
Domain name = www.example.com whose Server IP address is,
say = 253.136.27.2
Working of DNS
The working of DNS is explained below in stepwise manner −
Step 1 − Every website has a domain name/ IP address associated with it.
Step 2 − Now IP is a bit complicated to share (as no one wants to write
192.168.224.23 or some random IP to access Tutorials point) so people came up
with an idea of domain names which basically stores the IP address mapped to
their name.
Step 3 − Now, a DNS translates every domain name to its IP address so every
browser can access that particular website.
Step 4 − DNS has eased the process of web surfing as we write tutorialspoint.com
to reach a website instead of some complicated 32-128 bit address.
Given below is the diagram of DNS −
TLD = TOP LEVEL DOMAIN NAME
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.
(https://www.youtube.com/watch?v=B9T2C64uN7Q)
HTTP
o HTTP stands for HyperText Transfer Protocol.
o It is a protocol used to access the data on the World Wide Web (www).
o The HTTP protocol can be used to transfer the data in the form of plain text,
hypertext, audio, video, and so on.
o This protocol is known as HyperText Transfer Protocol because of its
efficiency that allows us to use in a hypertext environment where there are
rapid jumps from one document to another document.
o HTTP is similar to the FTP as it also transfers the files from one host to
another host. But, HTTP is simpler than FTP as HTTP uses only one
connection, i.e., no control connection to transfer the files.
o HTTP is used to carry the data in the form of MIME-like format.
o HTTP is similar to SMTP as the data is transferred between client and
server. The HTTP differs from the SMTP in the way the messages are sent
from the client to the server and from server to the client. SMTP messages
are stored and forwarded while HTTP messages are delivered immediately.
o HTTP Transactions
o
o The above figure shows the HTTP transaction between client and server.
The client initiates a transaction by sending a request message to the server.
The server replies to the request message by sending a response message.
o Messages
o HTTP messages are of two types: request and response. Both the message
types follow the same message format.
o
o Request Message: The request message is sent by the client that consists of
a request line, headers, and sometimes a body.
o
o Response Message: The response message is sent by the server to the client
that consists of a status line, headers, and sometimes a body.
Email is a service which allows us to send the message in electronic mode over
the internet. It offers an efficient, inexpensive and real time mean of distributing
information among people.
E-Mail Address
Each user of email is assigned a unique name for his email account. This name is
known as E-mail address. Different users can send and receive messages
according to the e-mail address.
E-mail is generally of the form username@domainname. For example,
webmaster@tutorialspoint.com is an e-mail address where webmaster is username
and tutorialspoint.com is domain name.
The username and the domain name are separated by @ (at) symbol.
E-mail addresses are not case sensitive.
Spaces are not allowed in e-mail address.
FTP
Objectives of FTP
Why FTP?
Although transferring files from one system to another is very simple and
straightforward, but sometimes it can cause problems. For example, two systems
may have different file conventions. Two systems may have different ways to
represent text and data. Two systems may have different directory structures. FTP
protocol overcomes these problems by establishing two connections between hosts.
One connection is used for data transfer, and another connection is used for the
control connection.
Mechanism of FTP
The above figure shows the basic model of the FTP. The FTP client has three
components: the user interface, control process, and data transfer process. The
server has two components: the server control process and the server data transfer
process.