0% found this document useful (0 votes)
13 views147 pages

CN Unit - 1

The document provides an overview of computer networks, detailing their evolution from single computers to interconnected systems. It covers various types of networks, including Personal Area Networks (PANs), Local Area Networks (LANs), Metropolitan Area Networks (MANs), and Wide Area Networks (WANs), along with their applications and hardware components. Additionally, it discusses network software, protocol hierarchies, and the OSI and TCP/IP models that govern network communication.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views147 pages

CN Unit - 1

The document provides an overview of computer networks, detailing their evolution from single computers to interconnected systems. It covers various types of networks, including Personal Area Networks (PANs), Local Area Networks (LANs), Metropolitan Area Networks (MANs), and Wide Area Networks (WANs), along with their applications and hardware components. Additionally, it discusses network software, protocol hierarchies, and the OSI and TCP/IP models that govern network communication.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 147

Computer Networks

Unit-1

Introduction
Introduction
• The old model of a single computer serving all of the organization’s
computational needs has been replaced by one in which a large
number of separate but interconnected computers do the job. These
systems are called computer networks.
• Two computers are said to be interconnected if they are able to
exchange information. The connection need not be via a copper wire;
fiber optics, microwaves, infrared, and communication satellites can
also be used.
• They are usually connected together to make larger networks, with
the Internet being the most well-known example of a network of
networks.
USES OF COMPUTER NETWORKS
• Business Applications : • Mobile Users :
1. resource sharing 1. Text messaging or texting
2. client-server model 2. Smart phones,
3. communication medium 3. GPS (Global Positioning System)
4. Desktop sharing 4. NFC (Near Field Communication)

• Home Applications: • Social Issues : With the good


1. peer-to-peer communication comes the bad, as this new-
2. person-to-person communication found freedom brings with it
3. electronic commerce many unsolved social, political,
and ethical issues.
4. entertainment.(game playing,)
NETWORK HARDWARE
• Broadly speaking, there are two types of transmission technology that are in
widespread use: broadcast links and point-to-point links.
1. Broadcast systems usually also allow the possibility of addressing a packet
to all destinations by using a special code in the address field. When a
packet with this code is transmitted, it is received and processed by every
machine on the network. This mode of operation is called broadcasting.
Some broadcast systems also support transmission to a subset of the
machines, which known as multicasting.
2. Point-to-point links connect individual pairs of machines. To go from the
source to the destination on a network made up of point-to-point links,
short messages, called packets in certain contexts, may have to first visit
one or more intermediate machines. Point-to-point transmission with
exactly one sender and exactly one receiver is sometimes called unicasting.
NETWORK HARDWARE Cont.....

• we classify multiple processor


systems by their rough physical
size.
• At the top are the personal area
networks, networks that are
meant for one person and so on.
1. Personal Area Networks
• PANs (Personal Area Networks) let devices
communicate over the range of a person.
• A common example is a wireless network that
connects a computer with its peripherals.
• To help these users, some companies got
together to design a short-range wireless
network called Bluetooth to connect these
components without wires.
• PANs can also be built with other technologies
that communicate over short ranges, such as
RFID (Radio Frequency IDentification) on
smartcards and library books.
2. Local Area Networks
• The next step up is the LAN (Local Area
Network). A LAN is a privately owned
network that operates within and nearby a
single building like a home, office or factory.
• LANs are widely used to connect personal
computers and consumer electronics to let
them share resources (e.g., printers) and
exchange information. When LANs are used
by companies, they are called enterprise
networks.
• Wireless LANs are very popular these days,
especially in homes, older office buildings,
cafeterias, and other places where it is too
much trouble to install cables.
• This device, called an AP (Access Point), wireless router, or base
station, relays packets between the wireless computers and also
between them and the Internet.
• There is a standard for wireless LANs called IEEE 802.11 (Institute of
Electrical and Electronic Engineers ), popularly known as WiFi, which
has become very widespread. It runs at speeds anywhere from 11 to
100 of Mbps.
• The topology of many wired LANs is built from point-to-point links.
IEEE 802.3, popularly called Ethernet, is, by far, the most common
type of wired LAN. Fig. 1-8(b) shows a sample topology of switched
Ethernet.
• Each computer speaks the Ethernet protocol and connects to a box
called a switch with a point-to-point link.
• A switch has multiple ports, each of which can connect to one
computer.
3. Metropolitan Area Networks
• A MAN (Metropolitan Area Network)
covers a city. The best-known examples of
MANs are the cable television networks
available in many cities.
• These systems grew from earlier
community antenna systems used in areas
with poor over-the-air television reception.
In those early systems, a large antenna was
placed on top of a nearby hill and a signal
was then piped to the subscribers’ houses.
• Cable television is not the only MAN,
though. Recent developments in high
speed wireless Internet access have
resulted in another MAN, which has been
standardized as IEEE 802.16 and is
popularly known as WiMAX.
4. Wide Area Networks
• A WAN (Wide Area Network)
spans a large geographical area,
often a country or continent. We
will begin our discussion with
wired WANs, using the example
of a company with branch
offices in different cities.
• We will follow traditional usage
and call these machines hosts.
The rest of the network that
connects these hosts is then
called the communication
subnet, or just subnet.
• The job of the subnet is to carry messages from host to host In most
WANs, the subnet consists of two distinct components: transmission
lines and switching elements.
• Transmission lines move bits between machines. They can be made
of copper wire, optical fiber, or even radio links.
• Switching elements, or just switches, are specialized computers that
connect two or more transmission lines. These switching computers
have been called by various names in the past; the name router is
now most commonly used.
NETWORK SOFTWARE
1. Protocol Hierarchies :
• To reduce their design complexity, most
networks are organized as a stack of layers
or levels, each one built upon the one below
it.
• The purpose of each layer is to offer certain
services to the higher layers while shielding
those layers from the details of how the
offered services are actually implemented.
• Basically, a protocol is an agreement
between the communicating parties on how
communication is to proceed.
• Violating the protocol will make
communication more difficult, if not
completely impossible.
• In Fig. 1-13, virtual communication is shown by dotted lines and
physical communication by solid lines.
• Between each pair of adjacent layers is an interface. The interface
defines which primitive operations and services the lower layer makes
available to the upper one.
• When network designers decide how many layers to include in a
network and what each one should do, one of the most important
considerations is defining clean interfaces between the layers.
• A set of layers and protocols is called a network architecture.
• A list of the protocols used by a certain system, one protocol per layer,
is called a protocol stack.
Example of Sending message :
2. Design Issues for the Layers
• Some of the key design issues that occur in computer networks will come up in
layer after layer.
• Reliability is the design issue of making a network that operates correctly even
though it is made up of a collection of components that are themselves unreliable.
• Think about the bits of a packet traveling through the network. There
• is a chance that some of these bits will be received damaged (inverted) due to
fluke electrical noise, random wireless signals, hardware flaws, software bugs and
so on.
• How is it possible that we find and fix these errors?
1. One mechanism for finding errors in received information uses codes for error
detection :
• Information that is incorrectly received can then be retransmitted until it is received
correctly. More powerful codes allow for error correction, where the correct message is
recovered from the possibly incorrect bits that were originally received.
2. Another reliability issue is finding a working path through a network:
• Often there are multiple paths between a source and destination, and in a large
network, there may be some links or routers that are broken. The network should
automatically make this decision. This topic is called routing.
3. Design issue concerns the evolution of the network:
• Over time, networks grow larger and new designs emerge that need to be connected to
the existing network.
4. Another design issue is resource allocation:
• Networks provide a service to hosts from their underlying resources, such as the capacity of
transmission lines. To do this well, they need mechanisms that divide their resources so that
one host does not interfere with another too much.
5. The last major design issue is to secure the network by defending it against
different kinds of threats:
• One of the threats is that of eavesdropping on communications. Mechanisms that
provide confidentiality defend against this threat, and they are used in multiple layers.
Mechanisms for authentication prevent someone from impersonating someone else.
3. Connection-Oriented Versus Connectionless Service
• Layers can offer two different types of service to the layers above
them: connection-oriented and connectionless.
1. Connection-oriented service is modeled after the telephone system.
To talk to someone, you pick up the phone, dial the number, talk,
and then hang up. Similarly, to use a connection-oriented network
service, the service user first establishes a connection, uses the
connection, and then releases the connection.
2. Connectionless service is modeled after the postal system. Each
message (letter) carries the full destination address, and each one is
routed through the intermediate nodes inside the system
independent of all the subsequent messages.
4. Service Primitives
• A service is formally specified by a set of
primitives (operations) available to user
processes to access the service.
• These primitives tell the service to perform
some action or report on an action taken
by a peer entity.
• If the protocol stack is located in the
operating system, as it often is, the
primitives are normally system calls.
• These calls cause a trap to kernel mode,
which then turns control of the machine
over to the operating system to send the
necessary packets.
Example of Client-Server interaction
5.The Relationship of Services to Protocols
• Services and protocols are distinct concepts.
• A service is a set of primitives (operations) that a layer
provides to the layer above it. A service relates to an
interface between two layers, with the lower layer
being the service provider and the upper layer being
the service user.
• A protocol, in contrast, is a set of rules governing the
format and meaning of the packets, or messages that
are exchanged by the peer entities within a layer.
• Entities use protocols to implement their service
definitions.
• They are free to change their protocols at will,
provided they do not change the service visible totheir
users. In this way, the service and the protocol are
completely decoupled.
The OSI Model
1. OSI stands for Open Systems Interconnection
2. Created by International Standards
Organization (ISO) in 1984
3. Was created as a framework and reference
model to explain how different networking
technologies work together and interact
4. It is not a standard that networking protocols
must follow
5. Each layer has specific functions it is
responsible for
6. All layers work together in the correct order to
move data around a network.
The OSI reference model
The Data is Referred to in the OSI Model and An exchange
using the OSI model :
1. Physical Layer 2. Data Link Layer
• Is responsible for moving frames from node to node or
• Deals with all aspects of physically moving computer to computer
data from one computer to the next
• Can move frames from one adjacent computer to another,
• Converts data from the upper layers into cannot move frames across routers
1s and 0s for transmission over media • Encapsulation = frame
• Defines how data is encoded onto the • Requires MAC address or physical address
media to transmit the data • Protocols defined include Ethernet Protocol and Point-to-
Point Protocol (PPP)
• Defined on this layer: Cable standards,
• Device example: Switch
wireless standards, and fiber optic
standards. Copper wiring, fiber optic • Two sublayers: Logical Link Control (LLC) and the Media
Access Control (MAC)
cable, radio frequencies, anything that
can be used to transmit data is defined on Logical Link Control (LLC) : Data Link layer addressing, flow
control, address notification, error control
the Physical layer of the OSI Model
Media Access Control (MAC) : Determines which computer
• Device example: Hub has access to the network media at any given time
• Used to transmit data Determines where one frame ends and the next one starts,
called frame synchronization
3. Network Layer 4. Transport Layer
• Responsible for moving • Takes data from higher levels of OSI Model and
packets (data) from one end breaks it into segments that can be sent to lower-
of the network to the other, level layers for data transmission
called end-to-end • Conversely, reassembles data segments into data
communications that higher-level protocols and applications can use
• Requires logical addresses • Also puts segments in correct order (called
such as IP addresses sequencing ) so they can be reassembled in correct
• Device example: Router : order at destination
• Routing is the ability of • Concerned with the reliability of the transport of
various network devices and sent data
their related software to • May use a connection-oriented protocol such as
move data packets from TCP to ensure destination received segments
source to destination • May use a connectionless protocol such as UDP to
send segments without assurance of delivery
• Uses port addressing
5. Session Layer 6. Presentation Layer
• Responsible for managing the • Concerned with how data is
dialog between networked
devices presented to the network
• Establishes, manages, and • Handles three primary tasks:
terminates connections Translation , Compression ,
• Provides duplex, half-duplex, or Encryption
simplex communications
between devices
• Provides procedures for
establishing checkpoints,
adjournment, termination, and
restart or recovery procedures
7. Application Layer
• Contains all services or protocols needed by application software
or operating system to communicate on the network
• Examples :
• Firefox web browser uses HTTP (Hyper-Text Transport Protocol)
• E-mail program may use POP3 (Post Office Protocol version 3) to
read e-mails and SMTP (Simple Mail Transport Protocol) to send
e-mails
The TCP/IP(Transmission Control Protocol/Internet
Protocol) Reference Model :
• From nearly the beginning, the
ability to connect multiple
networks in a seamless way was
one of the major design goals.
• This architecture later became
known as the TCP/IP Reference
Model
• A protocol suite is a large number
of related protocols that work
together to allow networked
computers to communicate.
1. Application Layer 2. Transport Layer
• Application layer protocols define the rules • TCP is a connection-oriented protocol : Does not
when implementing specific network mean it has a physical connection between sender
applications and receiver
• Rely on the underlying layers to provide TCP provides the function to allow a connection
accurate and efficient data delivery virtually exists – also called virtual circuit
Typical protocols: • UDP provides the functions : Dividing a chunk of
1. FTP – File Transfer Protocol (For file transfer) data into segments

2. Telnet – Remote terminal protocol (For Reassembly segments into the original chunk
remote login on any other computer on the Provide further the functions such as reordering
network) and data resend
3. SMTP – Simple Mail Transfer Protocol (For • Offering a reliable byte-stream delivery service
mail transfer) • Functions the same as the Transport layer in OSI
4. HTTP – Hypertext Transfer Protocol (For Web • Synchronize source and destination computers to
browsing) set up the session between the respective
5. Encompasses same functions as these OSI computers
Model layers Application Presentation
Session
3. Internet Layer 4. Data link Layer and Physical
• The network layer, also called Layer
the internet layer, deals with • The Host-to-network layer is the
packets and connects lowest layer of the TCP/IP
independent networks to reference model.
transport the packets across • It combines the link layer and
network boundaries. the physical layer of the ISO/OSI
• The network layer protocols are model.
the IP and the Internet Control • At this layer, data is transferred
Message Protocol (ICMP), which between adjacent network
is used for error reporting. nodes in a WAN or between
nodes on the same LAN.
A Comparison of the OSI and TCP/IP Reference Models
• OSI(Open System Interconnection) • TCP/IP(Transmission Control Protocol / Internet
Protocol)
1. OSI is a generic, protocol-independent
1. TCP/IP model is based on standard protocols
standard, acting as a communication around which the Internet has developed. It is a
gateway between the network and end-user. communication protocol, which allows the
2. It has 7 layers connection of hosts over a network.
2. It has 4 layers
3. Follows vertical approach.
3. Follows horizontal approach.
4. OSI model has a separate Presentation layer
and Session layer. 4. TCP/IP does not have a separate Presentation
layer or Session layer.
5. Transport Layer is Connection Oriented. 5. Transport Layer is both Connection-Oriented and
6. Network Layer is both Connection-Oriented Connectionless.
and Connectionless. 6. Network Layer is Connectionless.
7. Protocols are hidden in the OSI model and 7. In TCP/IP replacing protocol is not easy.
are easily replaced as the technology
changes.
EXAMPLE NETWORKS : The Internet
• The Internet has revolutionized many aspects of our daily lives.
• It has affected the way we do business as well as the way we spend
our leisure time.
• Perhaps you've sent electronic mail (e-mail) to a business associate,
paid a utility bill, read a newspaper from a distant city, or looked up a
local movie schedule-all by using the Internet. Or
• Maybe you researched a medical topic, booked a hotel reservation,
chatted with a fellow Trekkie, or comparison-shopped for a car.
• The Internet is a communication system that has brought a wealth of
information to our fingertips and organized it for our use.
A Brief History : The ARPANET
• In the mid-1960s, mainframe computers in research organizations were standalone
devices.
• Computers from different manufacturers were unable to communicate with one
another.
• The Advanced Research Projects Agency (ARPA) in the Department of Defense
(DoD) was interested in finding a way to connect computers so that the
researchers they funded could share their findings, thereby reducing costs and
eliminating duplication of effort.
• In 1967, at an Association for Computing Machinery (ACM) meeting, ARPA
presented its ideas for ARPANET, a small network of connected computers.
• The idea was that each host computer would be attached to a specialized
computer, called an interface message processor (IMP). The IMPs, in tum, would
be connected to one another. Each IMP had to be able to communicate with other
IMPs as well as with its own attached host. By 1969, ARPANET was a reality.
Physical Layer
• The physical layer is the
foundation on which the
network is built.
• The properties of different
kinds of physical channels
determine the performance
(e.g., throughput, latency, and
error rate)
GUIDED TRANSMISSION MEDIA
• The purpose of the physical layer is to
transport bits from one machine to
another.
• Various physical media can be used for the
actual transmission.
• Each one has its own niche in terms of
bandwidth, delay, cost, and ease of
installation and maintenance.
• Media are roughly grouped into guided
media, such as copper wire and fiber
optics, and
• unguided media, such as terrestrial
wireless, satellite, and lasers through the
air.
Twisted Pairs
• A twisted pair consists of two conductors
(normally copper), each with its own
plastic insulation, twisted together.
• One of the wires is used to carry signals to
the receiver, and the other is used only as
a ground reference.
• Unshielded Versus Shielded Twisted-Pair
Cable
1. The most common twisted-pair cable
used in communications is referred to as
unshielded twisted-pair (UTP). Applications
2. STP cable has a metal foil or braided mesh • Twisted-pair cables are used in
covering that encases each pair of insulated telephone lines to provide voice and
conductors. data channels.
Coaxial Cable
• Coaxial cable (or coax) carries signals of
higher frequency ranges than those in
twisted pair cable.
• coax has a central core conductor of solid
or stranded wire (usuallycopper) enclosed
in an insulating sheath, which is, in turn,
encased in an outer conductor of metal
foil, braid, or a combination of the two.
• The most common type of connector used today is the
• The outer metallic wrapping serves both Bayone-Neill-Concelman (BNe), connector.
as a shield against noise and as the Applications
second conductor, which completes the • Coaxial cable was widely used in analog telephone
circuit. networks,digital telephone networks
• This outer conductor is also enclosed in • Cable TV networks also use coaxial cables.
an insulating sheath, and the whole cable • Another common application of coaxial cable is in traditional
is protected by a plastic cover. Ethernet LANs
Fiber-Optic Cable

• A fiber-optic cable is made of glass or plastic and transmits signals in the form of
light.
• Light travels in a straight line as long as it is moving through a single uniform
substance.
• Optical fibers use reflection to guide light through a channel.
• A glass or plastic core is surrounded by a cladding of less dense glass or plastic.
Applications
• Fiber-optic cable is often found in backbone networks because its widebandwidth is
cost-effective..
• Some cable TV companies use a combination of optical fiber and coaxialcable,thus
creating a hybrid network.
Propagation Modes
• Multimode is so named because multiple
beams from a light source move through
the core in different paths.
(In multimode step-index fiber, the density
of the core remains constant from the
center to the edges, multimode graded-
index fiber, decreases this distortion of the
signal through the cable)

• Single-Mode: Single-mode uses step-


index fiber and a highly focused source of
light that limits beams to a small range of
angles, all close to the horizontal.
UNGUIDED MEDIA: WIRELESS
• Unguided media transport
electromagnetic waves without
using a physicalconductor.
• This type of communication is
often referred to as wireless
communication.
1. Radio Waves
2. Microwaves
3. Infrared
Radio Waves
• Electromagnetic waves ranging in frequencies between 3
kHz and 1 GHz are normally called radio waves.
• Radio waves are omni directional.
• When an antenna transmits radio waves, they are
propagated in all directions.
• This means that the sending and receiving antennas do not
have to be aligned.
Applications
• The Omni directional characteristics of radio waves make
them useful for multicasting, in which there is one sender
but many receivers.
• AM and FM radio, television, maritime radio, cordless
phones, and paging are examples of multicasting.
Microwaves
• Electromagnetic waves having frequencies
between 1 and 300 GHz are called microwaves.
• Microwaves are unidirectional.
• The sending and receiving antennas need to be
aligned.
• The unidirectional property has an obvious
advantage.
• A pair of antennas can be aligned without
interfering with another pair of aligned antennas
Applications:
• Microwaves are used for unicast communication
such as cellular telephones, satellite networks, and
wireless LANs
Infrared
• Infrared waves, with frequencies from 300 GHz to 400 THz
(wavelengths from 1 mm to 770 nm), can be used for short-range
communication. Infrared waves, having high frequencies, cannot
penetrate walls.
• When we use our infrared remote control, we do not interfere with the
use of the remote by our neighbors.
• Infrared signals useless for long-range communication.
• In addition, we cannot use infrared waves outside a building because
the sun's rays contain infrared waves that can interfere with the
communication.
Applications:
• Infrared signals can be used for short-range communication in a closed
area using line-of-sight propagation.
Introduction
• At first you might think this problem is so trivial that there is nothing to study—
machine A just puts the bits on the wire, and machine B just takes them off.
• Unfortunately, communication channels make errors occasionally.
• Furthermore, they have only a finite data rate, and there is a nonzero
propagation delay between the time a bit is sent and the time it is received.
• These limitations have important implications for the efficiency of the data
transfer.
• The protocols used for communications must take all these factors into
consideration.
• After an introduction to the key design issues present in the data link layer, we
will start our study of its protocols by looking at the nature of errors and how
they can be detected and corrected.
DATA LINK LAYER DESIGN ISSUES
• The data link layer uses the services of the physical layer to send and receive
bits over communication channels. It has a number of functions, including:
1. Providing services to the network layer.
2. Framing
3. Physical Addressing
4. Flow Control
5. Error Control
1. Error detection
2. Error correction
6. Access Control
7. Reliable delivery
8. Half-Duplex & Full-Duplex
DATA LINK LAYER DESIGN ISSUES cont......
• To accomplish above goals, the data link
layer takes the packets it gets from the
network layer and encapsulates them
into frames for transmission.
• Each frame contains a frame header, a
payload field for holding the packet, and
a frame trailer.
• Frame management forms the heart of
what the data link layer does.
DATA LINK LAYER DESIGN ISSUES cont......
1. Providing services to the network layer:
a. Unacknowledged connectionless service : Appropriate for low error rate and
real-time traffic. Ex: Ethernet
b. Acknowledged connectionless service : Useful in unreliable channels, WiFi.
Ack/Timer/Resend
c. Acknowledged connection-oriented service : Guarantee frames are received
exactly once and in the right order. Appropriate over long, unreliable links such
as a satellite channel or a long-distance telephone circuit.

2. Framing: Frames are the streams of bits received from the network layer into
manageable data units. This division of stream of bits is done by Data Link Layer.

3. Physical Addressing: The Data Link layer adds a header to the frame in order
to define physical address of the sender or receiver of the frame, if the frames
are to be distributed to different systems on the network.
DATA LINK LAYER DESIGN ISSUES cont......
4. Flow Control: A receiving node can receive the frames at a faster rate than it
can process the frame. Without flow control, the receiver's buffer can overflow,
and frames can get lost. To overcome this problem, the data link layer uses the
flow control to prevent the sending node on one side of the link from
overwhelming the receiving node on another side of the link. This prevents
traffic jam at the receiver side.

5. Error Control: Error control is achieved by adding a trailer at the end of the
frame. Duplication of frames are also prevented by using this mechanism. Data
Link Layers adds mechanism to prevent duplication of frames.
Error detection: Errors can be introduced by signal attenuation and noise. Data Link
Layer protocol provides a mechanism to detect one or more errors.
Error correction: Error correction is similar to the Error detection, except that receiving
node not only detects the errors but also determine where the errors have occurred in
the frame.
DATA LINK LAYER DESIGN ISSUES cont......
6. Access Control: Protocols of this layer determine which of the
devices has control over the link at any given time, when two or more
devices are connected to the same link.

7. Reliable delivery: Data Link Layer provides a reliable delivery service,


i.e., transmits the network layer datagram without any error. A reliable
delivery service is accomplished with transmissions and
acknowledgements.

8. Half-Duplex & Full-Duplex: In a Full-Duplex mode, both the nodes


can transmit the data at the same time. In a Half-Duplex mode, only
one node can transmit the data at the same time.
Framing
• To provide service to the network layer, the data link layer must use the
service provided to it by the physical layer.
• What the physical layer does is baccept a raw bit stream and attempt to
deliver it to the destination.
• This bit stream is not guaranteed to be error free. The number of bits received
may be less than, equal to, or more than the number of bits transmitted, and
they may have different values.
• It is up to the data link layer to detect and, if necessary, correct errors.
• The usual approach is for the data link layer to break the bit stream up into
discrete frames and compute the checksum for each frame (framing).
• If the newly computed checksum is different from the one contained in the
frame, the data link layer knows that an error has occurred and takes steps to
deal with it (e.g., discarding the bad frame and possibly also sending back an
error report).
Framing Cont....
• We will look at four framing methods:
1. Byte count.
2. Flag bytes with byte stuffing.
3. Flag bits with bit stuffing.
4. Physical layer coding violations
1. Byte count.
• The first framing method uses a
field in the header to specify the
number of bytes in the frame.
When the data link layer at the
destination sees the byte count,
it knows how many bytes follow
and hence where the end of the
frame is.
• This technique is shown in figure
for four small example frames of
sizes 5, 5, 8, and 8 bytes,
respectively.
1. Byte count cont......
• The trouble with this algorithm is that the count can be garbled by a
transmission error. For example, if the byte count of 5 in the second
frame of Figure becomes a 7 due to a single bit flip, the destination
will get out of synchronization. It will then be unable to locate the
correct start of the next frame.
• Even if the checksum is incorrect so the destination knows that the
frame is bad, it still has no way of telling where the next frame starts.
• Sending a frame back to the source asking for a retransmission does
not help either, since the destination does not know how many
characters to skip over to get to the start of the retransmission.
• For this reason, the character count method is rarely used anymore.
2. Flag bytes with byte stuffing.
• This method gets around the problem of
resynchronization after an error by
having each frame start and end with
special bytes.
• In the past, the starting and ending bytes
were different, but in recent years most
protocols have used the same byte,
called a flag byte, as both the starting
and ending delimiter, as shown in Fig. (a)
as FLAG.
• In this way, if the receiver ever loses
synchronization, it can just search for the
flag byte to find the end of the current
frame.
• Two consecutive flag bytes indicate the
end of one frame and start of the next
one.
2. Flag bytes with byte stuffing cont.....
• It may easily happen that the flag byte's bit pattern occurs in the data. This
situation will usually interfere with the framing.
• One way to solve this problem is to have the sender's data link layer insert a
special escape byte (ESC) just before each ''accidental'' flag byte in the data.
• The data link layer on the receiving end removes the escape byte before the data
are given to the network layer. This technique is called byte stuffing or character
stuffing.
• Of course, the next question is: what happens if an escape byte occurs in the
middle of the data? The answer is that it, too, is stuffed with an escape byte. At
the receiver, the first escape byte is removed, leaving the data byte that follows it.
• The byte-stuffing scheme depicted is a slight simplification of the one used in PPP
(Point-to-Point Protocol), which is used to carry packets over communications
links.
• A major disadvantage of using this framing method is that it is closely tied to the
use of 8-bit characters. Not all character codes use 8-bit characters. For example
UNICODE uses 16-bit characters,
3. Flag bits with bit stuffing
• Framing can be also be done at the bit level, so
frames can contain an arbitrary number of bits
made up of units of any size.
• It was developed for the once very popular
HDLC (High level Data Link Control) protocol.
• Each frame begins and ends with a special bit
pattern, 01111110 or 0x7E in hexadecimal.
• Whenever the sender's data link layer
encounters five consecutive 1s in the data, it
automatically stuffs a 0 bit into the outgoing
bit stream.
• This bit stuffing is analogous to byte stuffing, in
which an escape byte is stuffed into the
outgoing character stream before a flag byte in
the data.
3. Flag bits with bit stuffing cont.....
• When the receiver sees five consecutive incoming 1 bits, followed by a 0
bit, it automatically de- stuffs (i.e., deletes) the 0 bit.
• Just as byte stuffing is completely transparent to the network layer in
both computers, so is bit stuffing.
• If the user data contain the flag pattern, 01111110, this flag is
transmitted as 011111010 but stored in the receiver's memory as
01111110.
• With bit stuffing, the boundary between two frames can be
unambiguously recognized by the flag pattern.
• Thus, if the receiver loses track of where it is, all it has to do is scan the
input for flag sequences, since they can only occur at frame boundaries
and never within the data.
4.Physical layer coding violations
• This method of framing is only applicable to networks in which the encoding
on the physical medium contains some redundancy.
• For example, some LANs encode 1 bit of data by using 2 physical bits.
• Normally, a 1 bit is a high-low pair and a 0 bit is a low-high pair.
• For example, in the 4B/5B line code 4 data bits are mapped to 5 signal bits to
ensure sufficient bit transitions. This means that 16 out of the 32 signal
possibilities are not used.
• We can use some reserved signals to indicate the start and end of frames.
• In effect, we are using ‘‘coding violations’’ to delimit frames.
• The beauty of this scheme is that, because they are reserved signals, it is easy
to find the start and end of frames and there is no need to stuff the data.
ERROR CONTROL : ERROR DETECTION AND CORRECTION
• A condition when the receiver’s information does not matches with the
sender’s information.
• During transmission, digital signals suffer from noise that can introduce errors
in the binary bits travelling from sender to receiver.
• That means a 0 bit may change to 1 or a 1 bit may change to 0.
• Network designers have developed two basic strategies for dealing with errors.
• One strategy is to include enough redundant information to enable the
receiver to deduce what the transmitted data must have been.
• The other is to include only enough redundancy to allow the receiver to
deduce that an error has occurred and have it request a retransmission.
• The former strategy uses error-correcting codes and the latter uses error-
detecting codes.
ERROR DETECTION : Error-Detecting Codes
• Whenever a message is transmitted, it may get scrambled by
noise or data may get corrupted. To avoid this, we use error-
detecting codes which are additional data added to a given digital
message to help us detect if any error has occurred during
transmission of the message.
• Implemented either at Data link layer or Transport Layer of OSI
Model
• Some popular techniques for error detection are:
1. Parity (Simple Parity check and Two-dimensional Parity check)
2. Checksums
3. Cyclic Redundancy Checks (CRCs)
1. Parity : Simple Parity check
• Blocks of data from the source are
subjected to a check bit or parity bit
generator form, where a parity of :
a. 1 is added to the block if it contains
odd number of 1’s, and
b. 0 is added if it contains even number
of 1’s
This scheme makes the total number of
1’s even, that is why it is called even
parity checking.
1. Parity : Two-dimensional Parity check
• Parity check bits are calculated
for each row, which is equivalent
to a simple parity check bit.
• Parity check bits are also
calculated for all columns, then
both are sent along with the data.
At the receiving end these are
compared with the parity bits
calculated on the received data.
2. Checksums
• The word ‘‘checksum’’ is often used to mean a group of check
bits associated with a message, regardless of how are calculated.
• The checksum is usually placed at the end of the message, as the
complement of the sum function.
• In checksum error detection scheme, the data is divided into k
segments each of m bits.
• In the sender’s end the segments are added using 1’s complement
arithmetic to get the sum. The sum is complemented to get the
checksum.
• The checksum segment is sent along with the data segments.
• At the receiver’s end, all received segments are added using 1’s
complement arithmetic to get the sum. The sum is complemented.
• If the result is zero, the received data is accepted; otherwise
discarded.
• The Internet checksum in particular is efficient and simple but
provides weak protection in some cases precisely because it is a
simple sum.
3. Cyclic redundancy checks (CRCs)
• stronger kind of error-detecting code is in
wide_x0002_spread use at the link layer: the CRC (Cyclic
Redundancy Check), also known as a polynomial code.
• Unlike checksum scheme, which is based on addition,
CRC is based on binary division.
• In CRC, a sequence of redundant bits, called cyclic
redundancy check bits, are appended to the end of data
unit so that the resulting data unit becomes exactly
divisible by a second, predetermined binary number.
• At the destination, the incoming data unit is divided by
the same number. If at this step there is no remainder,
the data unit is assumed to be correct and is therefore
accepted.
• A remainder indicates that the data unit has been
damaged in transit and therefore must be rejected.
• When the polynomial code method is employed, the
sender and receiver must agree upon a generator
polynomial, G(x), in advance.
ERROR DETECTION : Error-Correcting Codes
• Error Correction codes are used to detect and correct the errors when data is transmitted from
the sender to the receiver.
Error Correction can be handled in two ways:
• Backward error correction: Once the error is discovered, the receiver requests the sender to
retransmit the entire data unit.
• Forward error correction: In this case, the receiver uses the error-correcting code which
automatically corrects the errors.
• 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.
We will examine four different error-correcting codes:
1. Hamming codes
2. Binary convolutional codes
3. Reed-Solomon codes
4. Low-Density Parity Check codes
1. Hamming codes
• In Hamming codes the bits of the codeword are numbere
dconsecutively, starting with bit 1 at the left end, bit 2 to its immediate
right, and so on.
• The bits that are powers of 2 (1, 2, 4, 8, 16, etc.) are check bits. The rest
(3,5, 6, 7, 9, etc.) are filled up with the m data bits.
• In the example, the check bits are computed for even parity sums for a
message that is the ASCII letter ‘‘A.’’
1. Hamming codes Algorithm
Relationship b/w Error position & binary number.
1. An information of 'd' bits are added
to the redundant bits 'r' to form d+r.
2. The location of each of the (d+r)
digits is assigned a decimal value.
3. The 'r' bits are placed in the
positions 1,2,.....2k-1
4. At the receiving end, the parity bits Let's understand the concept of Hamming code through
are recalculated. The decimal value an example:

of the parity bits determines the Suppose the original data is 1010 which is to be sent.
position of an error. 1. Total number of data bits 'd' = 4
2. Number of redundant bits r : 2r>= d+r+1
2r>= 4+r+1
3. Therefore, the value of r is 3 that satisfies the above
relation.
4. Total number of bits = d+r = 4+3 = 7;
Let's understand the concept of Hamming code through an Example Cont.......
• Determining the position of the
redundant bits.
• 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 Representation of Data on the addition of parity bits:
corresponds to the raised power
of 2.
• Therefore, their corresponding
positions are 1, 21, 22.
• The position of r1 = 1, The
position of r2 = 2 , The position
of r4 = 4
Let's understand the concept of Hamming code through an Example Cont.......
• Determining the Parity bits
• Determining the r1 bit: 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 position 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.
Let's understand the concept of Hamming code through an Example Cont.......
• Data transferred is given below: Suppose the 4th bit is changed from
0 to 1 at the receiving end, then parity bits are recalculated.
• R1 bit : The bit positions of the r1 bit are 1,3,5,7. 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 : The bit positions of r2 bit are 2,3,6,7. We observe from the
above figure that the binary representation of r2 is 1001. Now, we
perform the even-parity check, the total number of 1s appearing in
the r2 bit is an even number. Therefore, the value of r2 is 0.
• R4 bit : The bit positions of r4 bit are 4,5,6,7. 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
• 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.
2. Binary convolutional codes
• In a convolutional code, an encoder processes a sequence of input bits
and generates a sequence of output bits.
• The output depends on the current and previous input bits. That is, the
encoder has memory. The number of previous bits on which the output
depends is called the constraint length of the code. Convolutional codes
are specified in terms of their rate and constraint length.
• Convolutional codes are widely used in deployed networks, for example,
as part of the GSM mobile phone system, in satellite communications,
and in 802.11. For example, if 111 is input and the
initial state is all zeros, the internal
• This code is known as the NASA convolutional code of r = 1/2 and k = 7, state, written left to right, will
since it was first used for the Voyager space missions starting in 1977. become 100000, 110000, and
Since then it has been liberally reused, for example, as part of 802.11. 111000 after the first, second, and
third bits have been input.
• each input bit on the left-hand side produces two output bits on the
The output bits will be 11, followed
right-hand side that are XOR sums of the input and internal state. Since it by 10, and then 01. It takes seven
deals with bits and performs linear operations, this is a binary, linear shifts toflush an input completely so
convolutional code. Since 1 input bit produces 2 output bits, the code that it does not affect the output.
rate is 1/2. It is not systematic since none of the output bits is simply the The constraint length of this code is
input bit. thus k = 7.
3. Reed-Solomon codes
• Like Hamming codes, Reed-Solomon codes are linear block codes, and they are often systematic too.
• Unlike Hamming codes, which operate on individual bits, Reed-Solomon codes operate on m bit
symbols.
• Reed-Solomon codes are based on the fact that every n degree polynomial is uniquely determined by n
+ 1 points.
• For example, a line having the form ax + b is determined by two points. Extra points on the same line
are redundant, which is helpful for error correction. Imagine that we have two data points that
represent a line and we send those two data points plus two check points chosen to lie on the same
line. If one of the points is received in error, we can still recover the data points by fitting a line to the
received points. Three of the points will lie on the line, and one point, the one in error, will not. By
finding the line we have corrected the error.
• Reed-Solomon codes are actually defined as polynomials that operate over finite fields, but they work
in a similar manner.
• Reed-Solomon codes are widely used in practice because of their strong error-correction properties,
particularly for burst errors.
• They are used for DSL, data over cable, satellite communications, and perhaps most ubiquitously on
CDs, DVDs, and Blu-ray discs.
4. Low-Density Parity Check codes
• LDPC codes are linear block codes that were invented by Robert Gallagher.
• In an LDPC code, each output bit is formed from only a fraction of the input
bits.
• This leads to a matrix representation of the code that has a low density of 1s,
hence the name for the code.
• The received codewords are decoded with an approximation algorithm that
iteratively improves on a best fit of the received data to a legal codeword. This
corrects errors.
• LDPC codes are practical for large block sizes and have excellent error-
correction abilities that outperform many other codes (including the ones we
have looked at) in practice.
• For this reason they are rapidly being included in new protocols. They are part
of the standard for digital video broadcasting, 10 Gbps Ethernet, power-line
networks, and the latest version of 802.11

You might also like