0% found this document useful (0 votes)
10 views85 pages

CN Notes

The document consists of lecture notes for a Computer Networks course, covering fundamental concepts of data communication, network types, and protocols. It details characteristics of data communication systems, components, data representation, and various network topologies such as bus, ring, star, and mesh. Additionally, it discusses network performance criteria, types of networks (LAN, MAN, WAN), and the process of switching in networks.

Uploaded by

xifafo1425
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)
10 views85 pages

CN Notes

The document consists of lecture notes for a Computer Networks course, covering fundamental concepts of data communication, network types, and protocols. It details characteristics of data communication systems, components, data representation, and various network topologies such as bus, ring, star, and mesh. Additionally, it discusses network performance criteria, types of networks (LAN, MAN, WAN), and the process of switching in networks.

Uploaded by

xifafo1425
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/ 85

LECTURE NOTES

COMPUTER NETWORKS (BCS502)


2023 – 2024

B. E V Semester

Mrs Ayisha Khanum, Assistant Professor

Department of Computer Science & Design Engineering

MODULE 1
Introduction: Data Communications, Networks, Network Types, Networks Models:
Protocol Layering, TCP/IP Protocol suite, The OSI model,
Textbook: Chapter: 1.1 - 1.3, 2.1 - 2.3

Introduction to Physical Layer: Transmission media, Guided Media, Unguided Media:


Wireless. Switching: Packet Switching and its types.
Text book: Chapters: 7.1 – 7.3, 8.3.
COMPUTER NETWORKS
MODULE 1
Introduction To Data Communication And Networking
Data Communication:

Data communication is the transfer of data between the source and the receiver via some form via
some form of transmission medium such as a wire cable. Source transmits the data and receiver receives it.
Nowadays, computing and telecommunications depend heavily on this data transmission, which makes a
variety of applications conceivable, including email, video chatting, the Internet, and many more things.

Fundamental Characteristics

The effectiveness of a data communication system depends on four fundamental characteristics:

1. Delivery- sender should send data to proper destination. Data must be received by the intended
device or user and only by that device or user.
2. Accuracy-data should be delivered accurately. Data that have been altered in transmission and left
uncorrected are unusable.
3. Timelines-data should reach in proper time. Data delivered late areuseless. In the case of video
and audio, timely delivery means delivering data as they are produced, in the same order that they
are produced, and without significant delay. This kind of delivery is called real-time transmission.
4. Jitter- variation in packet delivery delay. It is the uneven delay inthe delivery of audio or video packets.
Components of Data Communication

A communication system is made up of the following components:

1. Message: A message is a piece of information that is to be transmitted from one person to another. It
could be a text file, an audio file, a video file, etc.

2. Sender: It is simply a device that sends data messages. It can be a computer, mobile, telephone,
laptop, video camera, or workstation, etc.

3. Receiver: It is a device that receives messages. It can be a computer, telephone mobile, workstation,
etc.

4. Transmission Medium / Communication Channels: Communication channels are the medium that
connect two or more workstations. Workstations can be connected by either wired media or wireless
media.

5. Protocol: A protocol is a set of rules that govern data communications. It represents an agreement
between the communicating devices. Without a protocol, two devices may be connected but not
communicating, just as a person speaking French cannot be understood by a person who speaks only
Japanese.

Data Representation
Information today comes in different forms such as text, numbers, images, audio, and video.
Text
• In data communications, text is represented as a bit pattern, a sequence of bits (0s or 1s). Different
sets of bit patterns have been designed to represent text symbols. Each set is called a code, and the
process of representing symbols is called coding.
Numbers
• Numbers are also represented by bit patterns. However, a code such as ASCII is not usedto represent
numbers; the number is directly converted to a binary number to simplify mathematical operations.
Images
Images are also represented by bit patterns. In its simplest form, an image is composedof a matrix of
pixels. The size of thepixel depends on the resolution.
• After an image is divided into pixels, each pixel is assigned a bit pattern. The size and the value of
the pattern depend on the image. For an image made of only black- and-white, 1-bit pattern is enough
to represent a pixel.
• If an image is not made of pure white and pure black pixels, we can increase the size of the bit pattern
to include gray scale. For example, to show four levels of gray scale, we can use 2-bit patterns. A
black pixel can be represented by 00, a dark gray pixel by 01, a light gray pixel by 10, and a white
pixel by 11.
• There are several methods to represent color images. One method is called RGB, so called because
each color is made of a combination of three primary colors: red, green, and blue. The intensity of
each color is measured, and a bit pattern is assigned to
Audio
• Audio refers to the recording or broadcasting of sound or music. Audio is by nature different from
text, numbers, or images. It is continuous, not discrete.
Video
• Video refers to the recording or broadcasting of a picture or movie. Video can either beproduced as
a continuous entity or it can be a combination of images, each a discrete entity, arranged to convey
the idea of motion.
Data Flow
The data flow is a flow of data between two nodes or devices. The direction of data flow or
Communication can be in three forms. There are three ways of transmitting data as shown in Fig.
1. Simplex
2. Half duplex
3. Full duplex

1. Simplex Communication: It is one-way communication or we can say that unidirectional


communication in which one device only receives and another device only sends data and devices uses
their entire capacity in transmission. For example, entering data using a keyboard, listing music using a
speaker, etc.
2. Half Duplex communication: It is a two-way communication, or we can say that it is a bidirectional
communication in which both the devices can send and receive data but not at the same time. When one
device is sending data then another device is only receiving and vice-versa. For example, walkie-talkie.

3. Full-duplex communication: It is a two-way communication or we can say that it is a bidirectional


communication in which both the devices can send and receive data at the same time. For example,
mobile phones, landlines, etc.

NETWORKS

Network is an interconnection of set of devices to communicate each other. computer network is a


set of devices connected through links. A node can be computer, printer, or any other device capable of
sending or receiving the data. The links connecting the nodes are known as communication channels.

NODE: - It is capable of sending and receiving a data. ex: computers, workstation, router, switches etc

LINK: - It carries the data or information. It is responsible for sending and receiving the data. It can be
wired or wireless. Wired links are coaxial cable, Fiber optic cable, USB cable. Wireless links are infrared,
radio, microwave, satellite.

Network Criteria:
There are a lot of criteria that make a network better than others, but; there are three basic yet important
criteria to be fulfilled for a network performance, reliability, and security.

1. Performance: The two major tasks in a network are the Transmission and reception of information. We
need to focus on how fast a message is transmitted and how fast a node can receive a request and find
the needed information. It is measured in many ways
• Response time: The total time a node takes to process an inquiry or a request from another node/
device and respond.
• Throughput: Throughput measures how much data is transferred successfully from the sender node
to the receiver node in a particular time frame.
• Delay: Delay is the measure of time taken to do the delivery.

2. Reliability
It is the degree to which a network is trustworthy, consistent, and dependable. The Reliability of
a network is measured by the frequency of failures it is undergoing and the time it takes to recover from the
failures.
The Reliability of a network lies in how robust the Network is amid sudden major catastrophic
events/ failures.
3. Security
Network security issues include protecting data from unauthorized access, protecting data from
damage and development, and implementing policies and procedures for recovery from breaches and data
losses. In Reliability, the frequency of failures is checked.
In Security, network attacks and data breaches are checked. It is how the Network protects all the
important data and information at times of data breaches, unauthorized logins, damages, and viruses.

Physical Structures
Types of Connections
Point-to-Point:
• In this type of connection, a dedicated link is made between only two devices and no external device
can interfere between them. This means the capacity of the link is restricted to those two devices only.

• Point-to-point connection mostly uses a cable, but it can also be established using infrared, or other
satellite links also.

Multi-point:

• In this type of connection, the link is shared between multiple devices. The capacity of the
communication is not restricted to the two devices which was seen in the case of point-to-point.
• It is of two types – spatial and time shared.
• If many devices can share the link simultaneously, it is known as spatial. And in another case, if devices
share the link one by one in a time-shared manner, then it is known as time shared connection.

Physical Topology
• Physical Topology is the term used to describe the way in which a network is maintained. Arrangement
of nodes in such a way that we can make communication among all the nodes.
• The geometrical representation of a collection of two or more devices along with their links refers to the
network topology. Basically, there are four different types of topologies. These are – Mesh, Star, Bus,
and Ring.

Bus Topology
• The bus topology is designed in such a way that all the stations are connected through a single cable
known as a backbone cable.
• Each node is either connected to the backbone cable by drop cable or directly connected to the
backbone cable.
• When a node wants to send a message over the network, it puts a message over the network. All the
stations available in the network will receive the message whether it has been addressed or not.
Advantages of bus topology

• It works very efficiently well when there is a small network.


• Very cost-effective as compared to another network topology.
• Easy to expand by joining the two cables together.
Disadvantages of Bus Topology
• Bus topology is not good for large networks.
• A fault or break in the network breaks entire transmission.
• This network topology is very slow as compared to other topologies.
• Security is very low.
RING TOPOLOGY
• It is like a bus topology in a closed loop.
• All devices are connected point to point in a shape of ring.
• A signal is passed along the ring from one device to another device until it reaches its destination.
• Sending and receiving data takes place with the help of token.
• Data flow is unidirectional.

Advantages of Ring topology:

Network Management: Faulty devices can be removed from the network without bringing the network
down.
Product availability: Many hardware and software tools for network operation and monitoring are
available.
Cost: Twisted pair cabling is inexpensive and easily available. Therefore, the installation cost is very
low.
Reliable: It is a more reliable network because the communication system is not dependent on the single
host computer.

Disadvantages of Ring topology:

o Difficult troubleshooting: It requires specialized test equipment to determine the cable faults. If any
fault occurs in the cable, then it would disrupt the communication for all the nodes.
o Failure: The breakdown in one station leads to the failure of the overall network.

o Reconfiguration difficult: Adding new devices to the network would slow down the network.

o Delay: Communication delay is directly proportional to the number of nodes. Adding new devices
increases the communication delay.

STAR TOPOLOGY

o Star topology is an arrangement of the network in which every node is connected to the central hub,
switch or a central computer. All the data or traffic must pass through the hub or switch

o The central computer is known as a server, and the peripheral devices attached to the server are
known as clients.

o Coaxial cable or RJ-45 cables are used to connect the computers.

o Hubs or Switches are mainly used as connection devices in a physical star topology.

o Star topology is the most popular topology in network implementation.

Advantages of Star topology:

o Efficient troubleshooting: Troubleshooting is quite efficient in a star topology. In a star topology,


all the stations are connected to the centralized network. Therefore, the network administrator has to
go to the single station to troubleshoot the problem.

o Network control: Complex network control features can be easily implemented in the star topology.
Any changes made in the star topology are automatically accommodated.

o Limited failure: As each station is connected to the central hub with its own cable, therefore failure
in one cable will not affect the entire network.

o Easily expandable: It is easily expandable as new stations can be added to the open ports on the
hub.

o Cost effective: Star topology networks are cost-effective as it uses inexpensive coaxial cable.

Disadvantages of Star topology:

o A Central point of failure: If the central hub or switch goes down, then all the connected nodes will
not be able to communicate with each other.

o Cable: Sometimes cable routing becomes difficult when a significant amount of routing is required.
MESH TOPOLOGY:

• Each node is connected to every other node in the network.

• When you send data from your device, it can take different routes to reach its destination, depending
on distance, traffic congestion, and link quality.

• This type of network is often used in large organizations or companies because it can handle a large
amount of data traffic and can be easily expanded.

Advantages of Mesh Topology

• Data can be transmitted from different devices simultaneously. It can withstand high traffic.

• Failure during a single device won’t break the network.

• Fault tolerant and reliable: Even if one connection breaks, the network keeps sending data through
other paths.

• It provides high privacy and security.

Disadvantages of Mesh Topology

• Overall cost of the network is too high compared to another topology.

• Setup and maintenance of this topology is very difficult.

NETWORK TYPES

A computer network can be categorized by their size.

o LAN(Local Area Network)

o MAN(Metropolitan Area Network)

o WAN(Wide Area Network)

LAN(Local Area Network)

• LAN is the most frequently used network. A LAN is a computer network that connects computers
through a common communication path, contained within a limited area, that is, locally. A LAN
encompasses two or more computers connected over a server.
• The two important technologies involved in this network are Ethernet and Wi-fi. It ranges up to 2km
& transmission speed is very high with easy maintenance and low cost. Examples of LAN are
networking in a home, school, library, laboratory, college, office, etc.
• LAN can be connected in two ways
• Wired LAN: devices connected with cables. Ex: Ethernet
• Wireless LAN: devices connected without cable. Ex: WI FI

Wide Area Network (WAN)

WAN is a type of computer network that connects computers over a large geographical distance through a
shared communication path. It is not restrained to a single location but extends over many locations.

WAN can also be defined as a group of local area networks that communicate with each other with a range
above 50km. Here we use Leased-Line & Dial-up technology. Its transmission speed is very low and it
comes with very high maintenance and very high cost. The most common example of WAN is the Internet.

Point-to-Point WAN
A point-to-point WAN is a network that connects two communicating devices through a transmission media (cable or
air). We will see examples of these WANs when we discuss how toconnect the networks to one another

Switched WAN
A switched WAN is a network with more than two ends. A switched WAN, as we will see shortly, is used in
the backbone of global communication today. We can say that a switched WAN is a combination of several
point-to-point WANs that are connected byswitches.
Internetwork

o An internetwork is defined as two or more computer network LANs or WAN or computer network
segments are connected using devices, and they are configured by a local addressing scheme. This
process is known as internetworking.

o An interconnection between public, private, commercial, industrial, or government computer


networks can also be defined as internetworking.

o An internetworking uses the internet protocol.

o The reference model used for internetworking is Open System Interconnection (OSI).

SWITCHING

Switching is the process of transferring data packets from one device to another in a network, or from one
network to another, using specific devices called switches.

Switching technique is used to connect the systems for making one-to-one communication. A switching
consists of interlinked nodes called switches.

Switches are hardware or software device capable of creating temporary connection between two devices.

A Switch forward data from a network to another network when required.

Switching network are categorized into

1. Circuit switched network

2. Packet switched network

Circuit switched network

• The switching technique is a connection-oriented network that is divided into pieces and has a dedicated path
established between the sender and receiver providing a guaranteed data rate.
• There is a Dedicated communication path is established between two networks. It consists of a set of switches
connected by physical links. A complete end-to-end path must exist before communication can take place.
• Circuit switching in a network operates in a similar way as the telephone works. Circuit switching takes at the
physical layer.
• Communication via circuit switching has three phases

1. Circuit Establishment: A dedicated circuit between the source and destination is constructed via a
number of intermediary switching centers. Communication signals can be requested and received
when the sender and receiver communicate signals over the circuit.
2. Data Transfer: Data can be transferred between the source and destination once the circuit has been
established. The link between the two parties remains as long as they communicate.
3. Circuit Disconnection: Disconnection in the circuit occurs when one of the users initiates the
disconnect. When the disconnection occurs, all intermediary linkages between the sender and
receiver are terminated.
PACKET-SWITCHED NETWORK

• In Packet Switched Network a small units of data called packets are routed through a
network based on the destination address contained within each packet.

• Each time one device sends a file to another, it breaks the file down into packets so that it
can determine the most efficient route for sending the data across the network at that time.

• In packet switching no resource allocation for a packet. Resources are allocated on


demand.

INTERNET:

• This is a wide area network. Internet is a worldwide system of interconnected computer


networks and electronic devices that communicate with each other using an established set
of protocols. There are so many WAN, LAN across the world are connected to each other. The
process of transferring information over the internet from one device to another relies on packet
switching.

• Internet is a global network that connects billions of computers across the world with each other and
to the World Wide Web. It uses standard internet protocol suite (TCP/IP) to connect billions of
computer users worldwide. It is set up by using cables such as optical fibers and other wireless and
networking technologies. At present, internet is the fastest mean of sending or exchanging
information and data between computers across the world.

Accessing the Internet

• Some common types of Internet service are:

• Dial-up: In dial-up connection, computer uses its modem to dial a telephone number given
to the user by an Internet Service Provider.

• DSL: DSL service uses a broadband connection, which makes it much faster than dial-up.
DSL connects to the Internet via a phone line but does not require you to have a landline
at home.
• Cable Networks: Cable service connects to the Internet via cable TV. It uses a broadband
connection and can be faster than both dial-up and DSL service; however, it is only
available where cable TV is available.

• Wireless Network:3G and 4G service is most commonly used with mobile phones, and it

• connects wirelessly through your ISP's network.

Custom Custom Custom Custom


er er er er

Provide Provide
r r

Peerin
g Peerin
g
Backbone

Provide Provide Provide


r r r

Custom Custom Custom Customer Custom


er er er Custom er

Protocol Layering

A protocol is a set of rules and standards that primarily outline a language that devices will use to
communicate. There are an excellent range of protocols in use extensively in networking, and that they are
usually implemented in numerous layers.

It provides a communication service where the process is used to exchange the messages. When the
communication is simple, we can use only one simple protocol.

When the communication is complex, we must divide the task between different layers, so, we need to
follow a protocol at each layer, this technique we used to call protocol layering.

Scenario1: A single layer protocol

In the first scenario, communication is so simple that it can occur in only one layer. Assume Maria and
Ann are neighbors with a lot of common ideas. Communication between Maria and Ann takes place in
one layer, face to face, in the same language, asshown in Figure 2.1.

Even in this simple scenario, we can see that a set of rules needs to be followed.
• First, Maria and Ann know that they should greet each other when they meet.
• Second, they know that they should confine their vocabulary to the level of their friendship.
• Third, each party knows that she should refrain from speaking when the other partyis speaking.
• Fourth, each party knows that the conversation should be a dialog, not a monolog: both should
have the opportunity to talk about the issue.
• Fifth, they should exchange some nice words when they leave.

Second Scenario:

In the second scenario, we assume that Ann is offered a higher-level position in her company, but
needs to move to another branch located in a city very far from Maria. The two friends still want to
continue their communication and exchange ideas because they have come up with an innovative project
to start a new business when they both retire. They decide to continue their conversation using regular
mail through the post office.

➢ Let us assume that Maria sends the first letter to Ann. Maria talks to the machine atthe third layer as
though the machine is Ann and is listening to her.
➢ The third layer machine listens to what Maria says and creates the plaintext (a letter in English), which
is passed to the second layer machine.
➢ The second layer machine takes the plaintext, encrypts it, and creates the ciphertext, which is passed
to the first layer machine.
➢ The first layer machine, presumably a robot, takes the ciphertext, puts it in an envelope, adds the
sender and receiver addresses, and mails it.
➢ At Ann’s side, the first layer machine picks up the letter from Ann’s mail box, recognizing the letter
from Maria by the sender address. The machine takes out the cipher- text from the envelope and
delivers it to the second layer machine.
➢ The second layer machine decrypts the message, creates the plaintext, and passes the plaintext to the
third-layer machine.
➢ The third layer machine takes the plaintext and reads it as though Maria is speaking.
➢ Protocol layering enables us to divide a complex task into several smaller and simpler tasks.

Principles of Protocol Layering

Frist principle

Both layers need to perform two opposite tasks.

1. First layer is to send and receive mail.


2. Second layer is to encrypt and decrypt.

3. Third layer is to listen or talk.

Second principle

The second principle that we need to follow in protocol layering is that the two objects
under each layer at both sites should be identical. For example, the objectunder layer 3 at both sites
should be a plaintext letter. The object under layer 2 at both sites should be a ciphertext letter. The
object under layer 1 at both sites shouldbe a piece of mail.

Logical connection

An imaginary connection established at each layer through which they can send the object created from that
layer.

TCP/IP PROTOCOL SUITE


The TCP/IP model is a fundamental framework for computer networking. It stands for
Transmission Control Protocol/Internet Protocol, which are the core protocols of the Internet.

This model defines how data is transmitted over networks, ensuring reliable communication between
devices.

The TCP/IP model consists of five layers: the application layer, transport layer, network layer, data link layer
and physical layer.

Each layer has specific functions that help manage different aspects of network communication, making it
essential for understanding and working with modern networks

TCP/IP is a hierarchical protocol made up of interactive modules, and each of them provides specific
functionality

Layered Architecture
To show how the layers in the TCP/IP protocol suite are involved in communication between two
hosts, we assume that we want to use the suite in a small internet made upof three LANs (links), each with a
link-layer switch.

Let us assume that computer A communicates with computer B. As the figure shows, we have
five communicating devices in this communication: source host (computer A), the link-layer switch in
link 1, the router, the link-layer switch in link 2,and the destination host (computer B).
Each device is involved with a set of layers depending on the role of the device in the internet. The
two hosts are involved in all fivelayers, the source host needs to create a message in the application layer
and send it down the layers so that it is physically sent to the destination host.
The destination hostneeds to receive the communication at the physical layer and then deliver it
through theother layers to the application layer.

The router is involved in only three layers; there is no transport or application layerin a router as long
as the router is used only for routing. Although a router is always involved in one network layer, it is involved
in n combinations of link and physical layers in which n is the number of links the router is connected to. The
reason is that eachlink may use its own data-link or physical protocol.
For example, in the above figure, therouter is involved in three links, but the message sent from source
A to destination B isinvolved in two links. Each link may be using different link-layer and physical-layer
protocols; the router needs to receive a packet from link 1 based on one pair of protocols and deliver it to
link 2 based on another pair of protocols.
A link-layer switch in a link, however, is involved only in two layers, data-link and physical. Although
each switch in the above figure has two different connections, the connections are in the same link, which
uses only one set of protocols. This means that,unlike a router, a link-layer switch is involved only in one
data-link and one physical layer.
Description of Each Layer

Physical layer

• This is the lowest layer of the TCP/IP model architecture.

• The physical layer is responsible for carrying individual bits in a frame across the link. Although the
physical layer is the lowest level in the TCP/IP protocol suite, the communication between two
devices at the physical layer is still a logical communication because there is another, hidden layer,
the transmission media, under the physical layer. Two devices are connected by a transmission
medium.

Data-link Layer

• It is responsible for moving packets through the link.

• The functions carried out by this layer are encapsulating the IP datagram into frames transmitted by
the network and mapping of IP addresses into physical addresses.

• It defines how the data should be sent physically through the network.

These two layers is mainly responsible for the transmission of the data between two devices on the same
network.

Network Layer

• A network layer is the third layer of the TCP/IP model.

• Communication at the network layer is host to host communication.


The network layer deals with packets and connects independent networks to transport the packets
across network boundaries. The network layer protocols are IP and Internet Control Message Protocol,
which are used for error reporting.

• Following are the protocols used in this layer are:

• IP Protocol

• ARP Protocol

• ICMP Protocol

IP PROTOCOL

➢ IP protocol is used in this layer, and it is the most significant part of the entire TCP/IP suite.

➢ Following are the responsibilities of this protocol:

➢ IP Addressing: This protocol implements logical host addresses known as IP addresses. The IP
addresses are used by the internet and higher layers to identify the device and to provide
internetwork routing.

➢ Host-to-host communication: It determines the path through which the data is to be transmitted.

➢ Data Encapsulation and Formatting: An IP protocol accepts the data from the transport layer
protocol. It encapsulates the data into message known as IP datagram.

➢ Routing: it is responsible for routing packet from source to its destination, which can be
accomplished by routing the IP datagram through various devices such as routers.

ARP

• ARP stands for Address Resolution Protocol.

• ARP is a network layer protocol which is used to find the physical address from the IP address.

ICMP

• ICMP stands for internet control message protocol.

• It stands for Internet Control Message Protocol and notification regarding datagram problems can be
sent back to the user using this. Any issue with the network is immediately notified to the user by
ICMP. It can only inform the user about the errors and cannot rectify the problem

Transport Layer :

The logical connection at the transport layer is also end-to-end. The transport layer at thesource host
gets the message from the application layer, encapsulates it in a transport layer packet (called a segment or a
user datagram in different protocols) and sends it, through the logical connection, to the transport layer at the
destination host.

the transport layer is responsible for giving services to the application layer: to get a message from an
application program running on the source host and deliver it to the corresponding application program on
the destination host

The two protocols used in the transport layer are User Datagram protocol and Transmission
control protocol.
User Datagram Protocol (UDP)

➢ It provides connectionless service and end-to-end delivery of transmission.

➢ It is a simple protocol.

➢ It is an unreliable protocol as it discovers the errors but not specify the error.

➢ User Datagram Protocol discovers the error, and ICMP protocol reports the error to the sender that
user datagram has been damaged.

Transmission Control Protocol (TCP)

• It provides a full transport layer services to applications.


• It creates a virtual circuit between the sender and receiver, and it is active for the duration of the
transmission.
• TCP is a reliable protocol as it detects the error and retransmits the damaged frames. Therefore, it
ensures all the segments must be received and acknowledged before the transmission is considered
to be completed and a virtual circuit is discarded.
• At the sending end, TCP divides the whole message into smaller units known as segment, and each
segment contains a sequence number which is required for reordering the frames to form an original
message.
• At the receiving end, TCP collects all the segments and reorders them based on sequence numbers.
• It provides flow control, error control and congestion control.

Application Layer
• An application layer is the topmost layer in the TCP/IP model.

• Communication at the application layer is between two processes. To communicate, a process sends
a request to the other process and receives a response. It is a process-to-process communication.

• This layer allows the user to interact with the application.

Following are the main protocols used in the application layer:

• HTTP: HTTP stands for Hypertext transfer protocol. This protocol allows us to access the data over
the world wide web. It transfers the data in the form of plain text, audio, video.

• SNMP: SNMP stands for Simple Network Management Protocol.it is used by administrator to
manage internet at global and local levels.

• SMTP: SMTP stands for Simple mail transfer protocol. Used in electronic mail service.

• DNS: DNS stands for Domain Name System. It is used by other protocols to find the network layer
address of a computer.

• TELNET: It is an abbreviation for Terminal Network. Accessing site remotely.

• FTP: FTP stands for File Transfer Protocol. FTP is a standard internet protocol used for transmitting
the files from one computer to another computer.

Encapsulation and Decapsulation


One of the important concepts in protocol layering in the Internet is encapsulation/ decapsulation
Encapsulation at the Source Host
At the source, we have only encapsulation.
1) At the application layer, the data to be exchanged is referred to as a message. A message normally does not
contain any header or trailer.
2) The transport layer takes the message as the payload, the load that the transport layer should take
care of. It adds the transport layer header to the payload, which contains the identifiers of the
source and destination application programs that want to communicate plus some more
information that is needed for the end-to- end delivery of the message, the transport layer then
passes thepacket to the network layer.
3) The network layer takes the transport-layer packet as data or payload and adds its own header to the
payload. The header contains the addresses of the source and destination hosts and some more information,
The result is the network-layer packet, called a datagram. The network layer then passes the packet to the
data-link layer.
4) The data-link layer takes the network-layer packet as data or payload and adds its own header, which
contains the link-layer addresses of the host or the next hop. The result is the link-layer packet, which is
called a frame. The frame is passed to the physical layer for transmission.

Decapsulation and Encapsulation at the Router


At the router, we have both decapsulation and encapsulation because the router is con- nected to two
or more links.
1) After the set of bits are delivered to the data-link layer, this layer decapsulates the datagram from
the frame and passes it to the network layer.
2) The network layer only inspects the source and destination addresses in the datagramheader and
consults its forwarding table to find the next hop to which the datagram is tobe delivered. The contents
of the datagram should not be changed by the network layer in the router unless there is a need to
fragment the datagram if it is too big to be passedthrough the next link. The datagram is then passed to
the data-link layer of the next link.
3) The data-link layer of the next link encapsulates the datagram in a frame and passes it to the
physical layer for transmission.

Decapsulation at the Destination Host


At the destination host, each layer only decapsulates the packet received, removes the payload,
and delivers the payload to the next-higher layer protocol until the message reaches the application layer.
It is necessary to say that decapsulation in the host involves error checking.

OSI MODEL
• OSI stands for Open System Interconnection is a reference model that describes how to facilitate
communication between different systems without requiring changes to the logic of the underlying
hardware or software.
• OSI model was developed by the International Organization for Standardization (ISO) in 1984, and
it is now considered as an architectural model for the inter-computer communications.
• OSI consists of seven layers, and each layer performs a particular network function.
• OSI model divides the whole task into seven smaller and manageable tasks. Each layer is assigned a
particular task.
• Each layer is self-contained, so that task assigned to each layer can be performed independently.

Layers of OSI Model


There are the seven OSI layers. Each layer has different functions. A list of seven layers is given
below:
1. Physical Layer
2. Data-Link Layer
3. Network Layer
4. Transport Layer
5. Session Layer
6. Presentation Layer
7. Application Layer
Each layer is related and each of which defines a part of the process of moving information across the
network.

OSI VERSUS TCP/IP


The biggest difference between the OSI and TCP/IP models is the OSI model has seven layers
instead of five. Although both the TCP/IP and OSI models transport data, the ways they send it are slightly
different.

The session and presentation layers are separate in OSI Model, but in TCP/IP model they are not
distinguished. TCP/IP model, the transport layer has more than one protocol, so some functionalities of
session layer is available in some transport layer protocol.
First, TCP/IP has more than one transport-layer protocol. Some of the functionalities of the session
layer are availablein some of the transport-layer protocols.
Second, the application layer is not only one piece of software. Many applications can be
developed at this layer. If some ofthe functionalities mentioned in the session and presentation layers
are needed for a particular application, they can be included in the development of that piece of software.
INTRODUCTION TO PHYSICAL LAYER

TRANSMISSION MEDIA

• Transmission media is located below the physical layer and are directly controlled by the physical
layer.

• Transmission media is a media that carries information from source to destination.


• The main functionality of the transmission media is to carry the information in the form of bits
through LAN (Local Area Network).
• It is a physical path between transmitter and receiver in data communication.
• In a copper-based network, the bits in the form of electrical signals.
• In a fiber based network, the bits in the form of light pulses.
• The electrical signals can be sent through the copper wire, fibre optics, atmosphere, water, and
vacuum.
• The characteristics and quality of data transmission are determined by the characteristics of medium
and signal.
• Transmission media is of two types are wired media and wireless media. In wired media, medium
characteristics are more important whereas, in wireless media, signal characteristics are more
important.
• Different transmission media have different properties such as bandwidth, delay, cost and ease of
installation and maintenance.
• The transmission media is available in the lowest layer i.e., Physical layer.

Types of transmission media


1. Guided media
2. Un guided media

Guided Media: Guided media is a communication medium that uses a physical medium
to transmit signals from sender to receiver. It is also referred to as wired media.
Types of Guided Transmission Media
1. Twisted Pair Cable
1. coaxial cable
2. fiber-optic cable

Twisted pair cable:


• It consists of two copper wires twisted together to form a single cable which reduces electromagnetic
interference.

• Copper wires are insulated so that both can transmit data simultaneously and eliminates crosstalk.

• With the help of twisting, noise and interference also get reduced. Suppose at some point one wire is
closer to the noise source while the other is farther, in the next twist reverse happens.

• Twisted-pair cables are of two types:

1. Unshielded twisted pair (UTP): These cables generally comprise wires and insulators. High
crosstalk. UTP cables are noisier. The UTP cable is used to establish the connection within a short
distance, like a home or small industry.

2. Shielded twisted pair (STP):These cables come with a braided, wired mesh that encases each pair
of insulated copper wires. Low crosstalk. STP cables are less noisier. It is used to establish the
connection for enterprises over a long distance.

Connectors
The most common UTP connector is RJ45 (RJ stands for registered jack), the RJ45 is a keyed
connector, meaning the connector can be inserted inonly one way.
Categories
The Electronic Industries Association (EIA) has developed standards to classify unshielded twisted-pair
cable into seven categories. Categories are determined by cablequality, with 1 as the lowest and 7 as the
highest. Each EIA category is suitable for specific uses. Table 7.1 shows these categories
Data Rate
Category Specification (Mbps) Use
1 Unshielded twisted-pair used in telephone  0.1 Telephone
2 Unshielded twisted-pair originally used in 2 T-1 lines
T lines
3 Improved CAT 2 used in LANs 10 LANs
4 Improved CAT 3 used in Token Ring networks 20 LANs
5 Cable wire is normally 24 AWG with a jacket 100 LANs
and outside sheath
5E An extension to category 5 that includes 125 LANs
extra features to minimize the crosstalk and
electromagnetic interference
6 A new category with matched components 200 LANs
coming from the same manufacturer. The cable
must be tested at a 200-Mbps data rate.
7 Sometimes called SSTP (shielded screen 600 LANs
twisted-pair). Each pair is individually wrapped
in a helical metallic foil followed by a metallic
foil shield in addition to the outside sheath. The
shield decreases the effect of crosstalk and
increases the data rate.
Applications:

• Twisted Pair cables are used in telephone lines to provide data and voice channels.

• The DSL lines make use of these cables.

• Local Area Networks (LAN) also make use of twisted pair cables.

• They can be used for both analog and digital transmission.

• RJ-45 connector is a very common application of twisted pair cables.

Co axial cable:
• Coaxial cable is very commonly used transmission media, for example, TV wire is usually a coaxial
cable.

• The name of the cable is coaxial as it contains two conductors parallel to each other.

• It has a higher frequency as compared to Twisted pair cable.

• The inner conductor of the coaxial cable is made up of copper, and the outer conductor is made up of
copper mesh. The middle core is made up of non-conductive cover that separates the inner conductor
from the outer conductor.

• The middle core is responsible for the data transferring whereas the copper mesh prevents from
the (Electromagnetic interference).

Co axial cable standards and connectors


➢ Coaxial cables are categorised by their radio government (RG) ratings.

➢ RG number denotes the unique set of physical specifications, i.e. wire gauge of inner conductors,
thickness and type of insulator, size and type of outer casing.

Connectors:
➢ To connect co axial cable to devices we need co axial connectors. The most common type of
connector used today is BNC connector.
Fiber optic cable:

• Fiber optic is a cable that holds the optical fibers coated in plastic that are used to transmit electrical
signals in the form of light.

• The plastic coating protects the optical fibers from heat, cold, electromagnetic interference from
other types of wiring.

• Fiber optics provide faster data transmission than copper wires.

Basic elements of Fiber optic cable:


• Core: The optical fiber consists of a narrow strand of glass or plastic known as a core. A core is a
light transmission area of the fiber.

• Cladding: The concentric layer of glass is known as cladding. The main functionality of the
cladding is to provide the lower refractive index at the core,

• Jacket: The protective coating consisting of plastic is known as a jacket. The main purpose of a
jacket is to preserve the fiber strength, absorb shock and extra fibre protection.

Working of fiber optic cable

• When a ray of light travels from a denser to a rarer medium such that the angle of incidence is
greater than the critical angle. The ray reflects back into the same medium this phenomena is called
TIR.
• In fibre optic cables the rays undergo repeated total number of reflections until it emerges out of the
other end of the fibre, even if fibre is bend.

Propagation modes

✓ The current technology supports two forms of propagating light along optical channels.

It is categorised into two mode:

1. Single mode fiber (SMF)

2. Multimode fiber(MMF)

Single mode fiber(SMF)

✓ Single-mode optical fiber permits only one type of light mode to be transmitted at a time.

✓ single-mode fiber can be utilized for long-distance use.

Multimode fiber(MMF):

• Step-index optical fiber: The refractive index of the core is constant. The refractive index of the
cladding is also continuous. The rays of light propagate through it in the form of meridional rays
which cross the fiber axis during every reflection at the core-cladding boundary.

• Graded index optical fiber: In this type of fiber, the core has a non-uniform refractive index that
gradually decreases from the center towards the core-cladding interface. The cladding has a uniform
refractive index. The light rays propagate through it in the form of skew rays or helical rays. It does
not cross the fiber axis at any time.

Fiber optic connectors:

The common types of fiber optic connectors are LC, SC, MTP/MPO, ST, and FC.
Applications of fiber optic cable:

1) cable tv companies

2) In telephone communication.

3) In broadband application.

4) In military application.

Advantages of fiber optic cable

1. Higher Bandwidth: The fiber optic cable provides more bandwidth as compared copper. Therefore,
the fiber optic carries more data as compared to copper cable.

2. Faster speed: Fiber optic cable carries the data in the form of light. This allows the fibre optic cable
to carry the signals at a higher speed.

3. Less signal attenuation: The fiber optic cable carries the data at a longer distance as compared to
copper cable.

4. Better reliability: The fiber optic cable is more reliable than the copper cable as it is immune to any
temperature changes while it can cause obstruct in the connectivity of copper cable.

5. Light weight: Fiber optic cable is thinner and lighter in weight so it can withstand more pull
pressure than copper cable.

• Disadvantage of fiber optic cable:

1. Installation and maintenance: It is new technology, requires expertise for installation and
maintenance.

2. Cost: It is more expensive than other guided media.

Unguided media

o An unguided transmission transmits the electromagnetic waves without using any physical medium.
Therefore, it is also known as wireless transmission.

o In unguided media, air is the media through which the electromagnetic energy can flow easily.

o Unguided signals can travel from the source to the destination in several ways: ground propagation, sky
propagation, and line-of-sight propagation, as shown in Figure

• In ground propagation, radio waves travel through the lowest portion of the atmosphere, hugging the
earth.
• In sky propagation, higher-frequency radio waves radiate upward into the ionosphere (the layerof
atmosphere where particles exist as ions) where they are reflected back to earth.
• In line-of-sight propagation, very high-frequency signals are transmitted in straight lines directly
fromantenna to antenna. Antennas must be directional, facing each other, and either tall enough or
close enough together not to be affected by the curvature of the earth.
Radio waves

o Radio waves are the electromagnetic waves that are transmitted in all the directions of free space.
o Radio waves are omnidirectional, when an antenna transmits radio waves, they are propagated in all
directions. In the case of radio waves, the sending and receiving antenna are not aligned, i.e., the
wave sent by the sending antenna can be received by any receiving antenna.
o Radio waves are those waves that propagate in the sky mode, can travel long distances. This makes
radio waves a good candidate for long-distance broadcasting such as AM radio.
o The range in frequencies of radio waves is from 3Khz to 1khz.
o Radio waves are used for multicast communications, an example of the radio wave is FM radio
and television.
Applications Of Radio waves:
o A Radio wave is useful for multicasting when there is one sender and many receivers.
o An FM radio, television, cordless phones are examples of a radio wave.
Advantages Of Radio transmission:
o Radio transmission is mainly used for wide area networks and mobile cellular phones.
o Radio waves cover a large area, and they can penetrate the walls.
o Radio transmission provides a higher transmission rate.
Microwave:
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.

Unidirectional Antenna

Microwaves need unidirectional antennas that send out signals in one direction. Two types of antennas are
used for microwave communications: the parabolic dish and the horn.

Characteristics of Microwave:

o Frequency range: The frequency range of terrestrial microwave is from 4-6 GHz to 21-23 GHz.

o Bandwidth: It supports the bandwidth from 1 to 10 Mbps.

o Short distance: It is inexpensive for short distance.

o Long distance: It is expensive as it requires a higher tower for a longer distance.


o Attenuation: Attenuation means loss of signal. It is affected by environmental conditions and
antenna size.

Applications of Microwaves

Microwaves, due to their unidirectional properties, are very useful when unicast (one- to-one)
communication is needed between the sender and the receiver. They are used in cellular phones, satellite
networks and wireless LANs.

Infrared
o An infrared transmission is a wireless technology used for communication over short ranges.
o The frequency of the infrared in the range from 300 GHz to 400 THz.
o It is used for short-range communication such as data transfer between two cell phones, TV remote
operation, data transfer between a computer and cell phone resides in the same closed area.
Characteristics Of Infrared:
o It supports high bandwidth, and hence the data rate will be very high.
o Infrared waves cannot penetrate the walls. Therefore, the infrared communication in one room
cannot be interrupted by the nearby rooms.
o An infrared communication provides better security with minimum interference.
o Infrared communication is unreliable outside the building because the sun rays will interfere with
the infrared waves.

Application of Infrared Signals


• Infrared signals can be used for short-range communication in a closed area using line-of-sight
propagation.
• Infrared technology is widely used in security systems, including motion detectors
and infrared cameras.
• Infrared sensors are employed in various automotive applications, such as night vision systems and
collision avoidance systems.
• Infrared technology is found in many consumer electronic devices, including remote controls
for televisions, air conditioners, and other appliances.

PACKET SWITCHING:

o The packet switching is a switching technique in which the message is sent in one go, but it is
divided into smaller pieces, and they are sent individually.

o The message splits into smaller pieces known as packets and packets are given a unique number to
identify their order at the receiving end.

o Every packet contains some information in its headers such as source address, destination address
and sequence number.

o Packets will travel across the network, taking the shortest path as possible.

o All the packets are reassembled at the receiving end in correct order.

o If any packet is missing or corrupted, then the message will be sent to resend the message.

o If the correct order of the packets is reached, then the acknowledgment message will be sent.
Two types of packets switched networks:

1. Datagram network
2.Virtual circuit network

Datagram network

• It is a packet switching technology in which packet is known as a datagram

• Each packet is considered as an independent entity. Each packet packets have a header with all of the
information about the destination and switch uses this information to forward the packet to the
correct destination.

• The packets are reassembled at the receiving end in correct order. In Datagram Packet Switching
technique, the path is not fixed. Intermediate nodes take the routing decisions to forward the packets.

• Datagram networks assign resources according to the First-Come-First-Serve (FCFS) principle.


Regardless of its source or destination, if another packet is being processed when a packet arrives at
a router, it must wait.

• Datagram Packet Switching is also known as connectionless switching.

Datagram packets transmitted between hosts H1 and H2 are shown in the diagram above. The same message
is being carried by the four datagram packets bearing the labels A, B, C, and D, each of which is being sent
by a separate path. The packets of the message reach their destination out of order. It is H2's responsibility to
rearrange the packets in order to recover the original message.
Problems during data transmission

• Datagrams can arrive out of order with different delays between the packets.

• Packets may also be lost or dropped because of lack of resources.

• In most protocols it is the responsibility of the upper layer protocol to reorder the datagrams or ask
for lost datagrams before passing them on to the application.

• There are no setup or teardown phases.

• How are the packets routed to their destination??

Routing table in a datagram network

• Each packet switch has a routing table which is based on the destination address.

• The routing tables are dynamic and are updated periodically.

• The destination addresses and the corresponding forwarding output ports are recorded in the tables.

• The destination address in the header of a packet in a datagram network remains the same during the
entire journey of the packet.

• When the switch receives the packet, this destination address is examined, the routing table is
consulted to find the corresponding port through which the packet should be forwarded.

Efficiency:

• Better than circuit switched network

• Resources are allocated only when there are packets to be transferred.

• If a source sends a packet and there is a delay of few minutes before another packet can be sent, the
resources can be reallocated during these minutes for other packets from other sources.

• Switching in the internet is done by using the datagram approach to packet switching at the network
layer.

Delay in datagram network:

• There may be greater delay in a datagram network than in a virtual circuit network.

• Although there are no setup and teardown phases, each packet may experience a wait at a switch
before it is forwarded.
Virtual circuit switching Network:

o Virtual Circuit Switching is also known as connection-oriented switching.

o In the case of Virtual circuit switching, a preplanned route is established before the
messages are sent.

o Call request and call accept packets are used to establish the connection between sender
and receiver.

o In this case, the path is fixed for the duration of a logical connection.

Characteristics:

• As in a circuit-switched network, there are setup and teardown phases in addition to the data
transfer phase.
• Resources can be allocated during the setup phase, as in a circuit-switched network,or on demand,
as in a datagram network.
• A virtual-circuit network is normally implemented in the data-link layer, while a circuit-switched
network is implemented in the physical layer and a datagram net-work in the network layer.
• As in a circuit-switched network, all packets follow the same path established duringthe connection.
• A virtual-circuit network is normally implemented in the data-link layer, while a circuit-switched
network is implemented in the physical layer and a datagram net-work in the network layer.
Virtual circuit switching Network Addressing
Global addressing

• Source and destination need unique addresses (used by the switches only to create a
virtual circuit identifier) during the setup phase.

Local Addressing (VCI- virtual circuit identifier):

• Actually, used for data transfer


• A small address used by a frame between two switches.
• When a frame arrives at a switch, it has a VCI; when it leaves, it has a different VCI. Figure 8.11
shows how the VCI in a data frame changes from one switch to another. Note that a VCI does not
needto be a large number since each switch can use its own unique set of VCIs.

Three phases:

As in a circuit-switched network, a source and destination need to go through three phases in a


virtual-circuit network: setup, data transfer, and teardown. In the setup phase, the source and destination use
their global addresses to help switches make tableentries for the connection. In the teardown phase, the
source and destination inform theswitches to delete the corresponding entry. Data transfer occurs between
these two phases.

Data-Transfer phase

To transfer a frame from a source to its destination, all switches need to have a table entry for this virtual
circuit. The table, in its simplest form, has four columns. This means that the switch holds four pieces of
information for each virtual circuit that is already set up.

Above figure shows a frame arriving at port 1 with a VCI of 14. When the frame arrives, the
switch looks in its table to find port 1 and a VCI of 14. When it is found, theswitch knows to change the VCI
to 22 and send out the frame from port 3.

The data-transfer phase is active until the source sends all its frames to the destination. The
procedure at the switch is the same for each frame of a message. The process creates a virtual circuit, not
a real circuit, between the source and destination.
Setup Acknowledgement

A setup request frame is sent from the source to the destination. Figure shows the process .

Source A sends a setup frame to switch 1.

1. Switch 1 receives the setup request frame. It knows that a frame going from A to Bgoes out through
port 3. The switch, in the setup phase, acts as a packet switch; it has a routing table which is
different from the switching table. The switch creates an entry in its table for this virtual circuit,
the switch assigns the incoming port (1) and chooses an available incoming VCI (14) and the
outgoing port (3). It does not yet know the outgoing VCI, which will be found during the
acknowledgment step. The switch then forwards the frame through port 3 to switch 2.
2. Switch 2 receives the setup request frame. The same events happen here as at switch 1; three columns of
the table are completed: in this case, incoming port (1),incoming VCI (66), and outgoing port (2).
3. Switch 3 receives the setup request frame. Again, three columns are completed: incoming port (2),
incoming VCI (22), and outgoing port (3).
4. Destination B receives the setup frame, and if it is ready to receive frames from A, it assigns a VCI to the
incoming frames that come from A, in this case 77. This VCI lets the destination know that the frames come
from A, and not other sources.

Data transfer and tear down phase

• After sending all frames, a special frame is send to end the connection.

• Destination B responds with tear down confirmation frame.


Delay in virtual circuit Network

• In datagram network each packet may experience a wait at a switch before it is forwarded. In
addition the delay is not uniform for

• The packets of a message in a virtual circuit network, there is a one-time delay for setup and a one-
time delay for tear down. If resource allocated during the setup phase, there is no Wait time for
individual packets.
COMPUTER NETWORKS
MODULE 2- Data Link Layer
Error Detection and Correction
10.1 INTRODUCTION
10.1.1 Types of Errors
• The term single-bit error means that only 1 bit of a given data unit is changed from 1
to 0 or from 0 to 1.
• The term burst error means that 2 or more bits in the data unit have changed from 1
to 0 or from 0 to 1.

10.1.2 Redundancy
• To be able to detect or correct errors, we need to send some extra bits with our data.
• These redundant bits are added by the sender and removed by the receiver. Their
presence allows the receiver to detect or correct corrupted bits.

10.1.3 Detection versus Correction


• In error detection, we see if any error has occurred. The answer is a simple yes or no.
• In error correction, we need to know the exact number of bits that are corrupted
and, more importantly, their location in the message.

10.1.4 Coding
• The sender adds redundant bits through a process that creates a relationship
between the redundant bits and the actual data bits.
• The receiver checks the relationships between the two sets of bits to detect errors.
• Coding schemes are divided into two broad categories: block coding and convolution
coding.

10.2 BLOCK CODING


• In block coding, we divide our message into blocks, each of k bits, called datawords.
We create n-bit codewords by adding r redundant bits to each k-
bit block, making the length n = k + r.
• With k bits, we can create a combination of 2k datawords; with n bits, we can create
a combination of 2n codewords. Since n > k, the number of possible codewords is
larger than the number of possible datawords. We have 2n − 2k codewords that are
not used. We call these codewords invalid or illegal.
• If the receiver receives an invalid codeword, this indicates that the data was
corrupted during transmission.

10.2.1 Error Detection


• If the following two conditions are met, the receiver can detect a change in the
original codeword.
1. The receiver has (or can find) a list of valid codewords.
2. The original codeword has changed to an invalid one.
• The sender uses a generator to create codewords from datawords by applying encod-
ing rules. These codewords might change during transmission.
• If the receiver gets a valid codeword, the corresponding dataword is extracted. If the
received codeword isn’t valid, it’s discarded. However, if a corrupted codeword still m
atches a valid one, the error goes unnoticed.

Example 10.1
Let us assume that k = 2 and n = 3. Table 10.1 shows the list of datawords and codewords.

Assume the sender encodes the dataword 01 as 011 and sends it to the receiver. Consider
the following cases:
1. The receiver receives 011. It is a valid codeword. The receiver extracts the dataword
01 from it.
2. The codeword is corrupted during transmission, and 111 is received This is not a valid
codeword and is discarded.
3. The codeword is corrupted during transmission, and 000 is received,a valid
codeword. The receiver incorrectly extracts the dataword 00. Two corrupted bits
have made the error undetectable.
An error-detecting code can detect only the types of errors for which it is designed; other
types of errors may remain undetected.

Hamming Distance
• The Hamming distance between two words is the number of differences between
the corresponding bits and the Hamming distance between two words x and y is
represented as d(x, y).
• The Hamming distance between the received codeword and the sent codeword is
the number of bits that are corrupted during transmission.
• If the Hamming distance between the sent and the received codeword is not zero,
the codeword has been corrupted during transmission.

• For example, if the codeword 00000 is sent and 01101 is received, 3 bits are in error
and the Hamming distance between the two is d(00000, 01101) = 3.
• If the d is not zero then message is corrupted.
• The Hamming distance can easily be found if we apply the XOR operation (⊕) on the
two words and count the number of 1s in the result.
• For example,the Hamming distance d(10101, 11110) is 3 because (10101 ⊕ 11110) is
01011 (three 1s).

Minimum Hamming Distance for Error Detection


• The minimum Hamming distance is the smallest Hamming distance between all
possible pairs of codewords.
• If our system is to detect up to s errors, the minimum distance between the valid
codes must be (s + 1), so that the received codeword does not match a valid
codeword.
• To guarantee the detection of up to s errors in all cases, the minimum Hamming
distance in a block code must be dmin = s + 1.

Example 10.3
The minimum Hamming distance for our first code scheme (Table 10.1) is 2. This code
guarantees detection of only a single error. For example, if the third codeword (101) is sent
and one error occurs, the received codeword does not match any valid codeword. If two
errors occur,however, the received codeword may match a valid codeword and the errors
are not detected.
Linear Block Codes

• A linear block code is a code in which the exclusive OR (addition modulo-2) of two
valid codewords creates another valid codeword.
Example 10.5
The code in Table 10.1 is a linear block code because the result of XORing any codeword with
any other codeword is a valid codeword.
Minimum Distance for Linear Block Codes

• The minimum Hamming distance is the number of 1s in the nonzero valid codeword
with the smallest number of 1s.

Example 10.6
In our first code (Table 10.1), the numbers of 1s in the nonzero codewords are 2, 2, and 2. So
the minimum Hamming distance is dmin = 2.
Parity-Check Code

• This code is a linear-block code.In this code, a k-bit dataword is changed to an n-bit
codeword where n = k + 1. The extra bit, called the parity bit, is selected to make the
total number of 1s in the codeword even.
• Minimum Hamming distance for this category is dmin = 2, which means that the
code is a single-bit error-detecting code. The code in Table 10.2 is also a parity-check
code with k = 4 and n = 5.

A possible structure of an encoder (at the sender) and a decoder(at the receiver).
• The encoder uses a generator that takes a copy of a 4-bit dataword (a0, a1, a2, and
a3) and generates a parity bit r0. The dataword bits and the parity bit create the 5-bit
codeword. The parity bit that is added makes the number of 1s in the codeword
even. In other words,
r0=a3+a2+a1+a0 (modulo-2)

• If the number of 1s is even, the result is 0; if the number of 1s is odd, the result is 1.
• The result, which is called the syndrome, is just 1 bit. The syndrome is 0 when the
number of 1s in the received codeword is even; otherwise, it is 1.
s0 = b3 + b2 + b1 + b0 + q0 (modulo-2)
• If the syndrome is 0, there is no detectable error in the received codeword; the data
portion of the received codeword is accepted as the dataword; if the syndrome is 1,
the data portion of the received codeword is discarded. The dataword is not created.
Example 10.7
Let us look at some transmission scenarios. Assume the sender sends the dataword 1011.
The codeword created from this dataword is 10111, which is sent to the receiver. We
examine five cases:
1. No error occurs; the received codeword is 10111. The syndrome is 0. The dataword
1011 is created.
2. One single-bit error changes a1. The received codeword is 10011. The syndrome is 1.
No dataword is created.
3. One single-bit error changes r0. The received codeword is 10110. The syndrome is 1.
No dataword is created. Note that although none of the dataword bits are corrupted,
no dataword is created because the code is not sophisticated enough to show the
position of the corrupted bit.
4. An error changes r0 and a second error changes a3. The received codeword is 00110.
The syndrome is 0. The dataword 0011 is created at the receiver. Note that here the
dataword is wrongly created due to the syndrome value. The simple parity-check
decoder cannot detect an even number of errors. The errors cancel each other out
and give the syndrome a value of 0.
5. Three bits—a3, a2, and a1—are changed by errors. The received codeword is 01011.
The syndrome is 1. The dataword is not created. This shows that the simple parity
check, guaranteed to detect one single error, can also find any odd number of errors.
A parity-check code can detect an odd number of errors.

10.3 CYCLIC CODES


• Cyclic codes are special linear block codes with one extra property. In a cyclic code, if
a codeword is cyclically shifted (rotated), the result is another codeword.
• For example,if 1011000 is a codeword and we cyclically left-shift, then 0110001 is
also a codeword.

10.3.1 Cyclic Redundancy Check


• A subset of cyclic codes called the cyclic redundancy check (CRC), which is used in
networks such as LANs and WANs.Table 10.3 shows an example of a CRC code. We
can see both the linear and cyclic properties of this code.

• In the encoder, the dataword has k bits (4 here); the codeword has n bits (7 here).
• The size of the dataword is augmented by adding n − k (3 here) 0s to the right-hand
side of the word. The n-bit result is fed into the generator. The generator uses a
divisor of size n − k + 1 (4 here), predefined and agreed upon.
• The generator divides the augmented dataword by the divisor (modulo-2 division).
The quotient of the division is discarded;the remainder (r 2r1r0) is appended to the
dataword to create the codeword.
• The decoder receives the codeword (possibly corrupted in transition). A copy of all n
bits is fed to the checker, which is a replica of the generator.
• The remainder produced by the checker is a syndrome of n − k (3 here) bits, which is
fed to the decision logic analyzer.
• If the syndrome bits are all 0s, the 4 left-most bits of the codeword are accepted as
the dataword (interpreted as no error); otherwise, the 4 bits are discarded (error).
Encoder

• The encoder takes a dataword and augments it with n − k number of 0s. It then
divides the augmented dataword by the divisor. (Explain the fig on your own)

• The 3-bit remainder forms the check bits (r2, r1, and r0). They are appended to the
dataword to create the codeword.

Decoder

• The decoder does the same division process as the encoder.If the syndrome is all 0s,
there is no error with a high probability; the dataword is separated from the received
codeword and accepted. Otherwise, everything is discarded. (Explain the fig on your
own)
10.3.2 Polynomials

• A pattern of 0s and 1s can be represented as a polynomial with coefficients of 0 and


1. The power of each term shows the position of the bit; the coefficient shows the
value of the bit.

Degree of a Polynomial

• The degree of a polynomial is the highest power in the polynomial.


Adding and Subtracting Polynomials

• In this case, the adding is in modulo-2. This has two consequences.


• First, addition and subtraction are the same.
• Second, adding or subtracting is done by combining terms and deleting pairs of
identical terms.
Multiplying or Dividing Terms

• In this arithmetic, multiplying a term by another term is very simple; we just add the
powers.
Multiplying Two Polynomials

• Multiplying a polynomial by another is done term by term. Each term of the first
polynomial must be multiplied by all terms of the second. The following is an
example:

Dividing One Polynomial by Another

• We divide the first term of the dividend by the first term of the divisor to get the first
term of the quotient.
• We multiply the term in the quotient by the divisor and subtract the result from the
dividend.
• We repeat the process until the dividend degree is less than the divisor degree.

Shifting
Shifting to the left is accomplished by multiplying each term of the polynomial by x m, where
m is the number of shifted bits; shifting to the right is accomplished by dividing each term of
the polynomial by xm.

10.3.3 Cyclic Code Encoder Using Polynomials

(Explain the above figure in your own words)

• In a polynomial representation, the divisor is normally referred to as the generator


polynomial t(x). The divisor in a cyclic code is normally called the generator
polynomial or simply the generator.
10.3.4 Cyclic Code Analysis
We define the following, where f(x) is a polynomial with binary coefficients.

In a cyclic code,
1. If s(x) ¦ 0, one or more bits is corrupted.

2. If s(x) = 0, either
a) No bit is corrupted, or
b) Some bits are corrupted, but the decoder failed to detect them.
• We want to find the criteria that must be imposed on the generator, g(x) to detect
the type of error, relationship among the sent codeword, error, received codeword,
and the generator. The received codeword is the sum of the sent codeword and the
error.
Received codeword = c(x) + e(x)
• The receiver divides the received codeword by g(x) to get the syndrome.
• Received codeword / g(x) = c(x) / g(x)+ e(x) / g(x)
Single-Bit Error

• A single-bit error is e(x) = xi , where i is the position of the bit.


• If a single-bit error is caught,then xi is not divisible by g(x).If g(x) has at least two
terms and the coefficient of x0 is not zero (the rightmost bit is 1), then e(x) cannot be
divided by g(x).
• If the generator has more than one term and the coefficient of x0 is 1,all single-bit
errors can be caught.
Two Isolated Single-Bit Errors
The values of i and j define the positions of the errors, and the difference j − i defines the
distance between the two errors, as shown in Figure 10.10

Odd Numbers of Errors


A generator with a factor of x + 1 can catch all odd numbers of errors. This means that we
need to make x + 1 a factor of any generator.
Burst Errors

• A burst error is of the form e(x) = (xj + . . . + xi).


• Note the difference between a burst error and two isolated single-bit errors. The first
can have two terms or more; the second can only have two terms. We can factor out
xi and write the error as xi(xj–i + . . . + 1).
• If our generator can detect a single error (minimum condition for a generator), then
it cannot divide xi. What we should worry about are those generators that divide xj–i +
. . . + 1. We can have three cases:
a) If j − i < r, the remainder can never be zero. We can write j − i = L − 1, where L is the
length of the error. So L − 1 < r or L < r + 1 or L ð r. This means all burst errors with
length smaller than or equal to the number of check bits r will be detected.
b) In some rare cases, if j − i = r, or L = r + 1, the syndrome is 0 and the error is
undetected. It can be proved that in these cases, the probability of undetected burst
error of length r + 1 is (1/2)r–1.
c) In some rare cases, if j − i > r, or L > r + 1, the syndrome is 0 and the error is
undetected. It can be proved that in these cases, the probability of undetected burst
error of length greater than r + 1 is (1/2)r.
Standard Polynomials
Some standard polynomials used by popular protocols for CRC generation are shown in
Table 10.4 along with the corresponding bit pattern.
10.3.5 Advantages of Cyclic Codes

• They have very good performance in detecting single-bit errors, double errors, an
odd number of errors, and burst errors.
• They can easily be implemented in hardware and software.
• They are especially fast when implemented in hardware. This has made cyclic codes a
good candidate for many networks.

10.3.6 Other Cyclic Codes

• There are, however, more powerful polynomials that are based on abstract algebra
involving Galois fields.
10.3.7 Hardware Implementation

• One of the advantages of a cyclic code is that the encoder and decoder can easily and
cheaply be implemented in hardware by using a handful of electronic devices.
• Also, a hardware implementation increases the rate of check bit and syndrome bit
calculation.
Divisor

• Let us first consider the divisor. We need to note the following points:
1. The divisor is repeatedly XORed with part of the dividend.
2. The divisor has n − k + 1 bits which either are predefined or are all 0s. In other words,
the bits do not change from one dataword to another.
3. A close look shows that only n − k bits of the divisor are needed in the XOR
operation. The leftmost bit is not needed because the result of the operation is
always 0,no matter what the value of this bit.
Using these points, we can make a fixed (hardwired) divisor that can be used for a cyclic
code if we know the divisor pattern.
Augmented Dataword

• We show the augmented dataword as fixed in position with the divisor bits shifting to
the right, 1 bit in each step.
• The divisor bits are aligned with the appropriate part of the augmented dataword.
Since our divisor is fixed, we need instead to shift the bits of the augmented
dataword to the left (opposite direction) to align the divisor bits with the appropriate
part.
Remainder
The remainder is 3 bits (n − k bits in general) in length. We can use three registers (single-bit
storage devices) to hold these bits. The following is the step-by-step process that can be
used to simulate the division process in hardware.
1. We assume that the remainder is originally all 0s (000 in our example).
2. At each time click (arrival of 1 bit from an augmented dataword), we repeat the
following two actions:
a) We use the leftmost bit to make a decision about the divisor (011 or 000).
b) The other 2 bits of the remainder and the next bit from the augmented dataword
(total of 3 bits) are XORed with the 3-bit divisor to create the next remainder.

• Steps 1, 2, and 3 push the first 3 bits to the remainder registers; steps 4, 5, 6, and 7
match the paper-and-pencil design. Note that the values in the remainder register in
steps 4 to 7 exactly match the values in the paper-and-pencil design.
• We need, however, to make the registers shift registers. A 1-bit shift register holds a
bit for a duration of one clock time.
• At a time click, the shift register accepts the bit at its input port, stores the new bit,
and displays it on the output port.
• The content and the output remain the same until the next input arrives. When we
connect several 1-bit shift registers together, it looks as if the contents of the register
are shifting.

General Design

10.4 CHECKSUM
• Checksum is an error-detecting technique that can be applied to a message of any
length. In the Internet, the checksum technique is mostly used at the network and
transport layer rather than the data-link layer.
• At the source, the message is first divided into m-bit units. The generator then
creates an extra m-bit unit called the checksum, which is sent with the message.
• At the destination, the checker creates a new checksum from the combination of the
message and sent checksum. If the new checksum is all 0s, the message is accepted;
otherwise,the message is discarded.
10.4.1 Concept

One’s Complement Addition

• In this arithmetic, we can represent unsigned numbers between 0 and 2m − 1 using


only m bits.
• If the number has more than m bits, the extra leftmost bits need to be added to the
m rightmost bits (wrapping).
Example 10.12
The decimal number 36 in binary is (100100)2. To change it to a 4-bit number we add the
extra leftmost bit to the right four bits as shown below.

Instead of sending 36 as the sum, we can send 6 as the sum (7, 11, 12, 0, 6, 6).
Checksum

• We can make the job of the receiver easier if we send the complement of the sum,
the checksum. This is the same as subtracting the number from 2m − 1.
• If we add a number with its complement, we get a negative zero (a number with all
bits set to 1). When the receiver adds all five numbers (including the checksum), it
gets a negative zero.
• The receiver can complement the result again to get a positive zero.

Example 10.13
The sender adds all five numbers in one’s complement to get the sum = 6. The sender then
complements the result to get the checksum = 9, which is 15 − 6. Note that 6 = (0110)2 and
9 = (1001)2; they are complements of each other. The sender sends the five data numbers
and the checksum (7, 11, 12, 0, 6, 9). If there is no corruption in transmission, the receiver
receives (7, 11, 12, 0, 6, 9) and adds them in one’s complement to get 15.The sender
complements 15 to get 0. This shows that data have not been corrupted. Figure 10.16 shows
the process.

Internet Checksum

• Traditionally, the Internet has used a 16-bit checksum. The sender and the receiver
follow the steps depicted in Table 10.5. The sender or the receiver uses five steps.

Algorithm

• A program in any language can easily be written based on the algorithm.


• The first loop just calculates the sum of the data units in two’s complement;the
second loop wraps the extra bits created from the two’s complement calculation to
simulate the calculations in one’s complement.
Performance

• The traditional checksum uses a small number of bits (16) to detect errors in a
message of any size (sometimes thousands of bits).

10.4.2 Other Approaches to the Checksum


• If two 16-bit items are transposed in transmission, the checksum cannot catch this
error. The reason is that the traditional checksum is not weighted: it treats each data
item equally.
• Several approaches have been used to prevent this problem. We mention two of
them here: Fletcher and Adler.
Fletcher Checksum

• The Fletcher checksum was devised to weight each data item according to its
position.Fletcher has proposed two algorithms: 8-bit and 16-bit.
• The first, 8-bit Fletcher, calculates on 8-bit data items and creates a 16-bit checksum.
• The second, 16-bit Fletcher,calculates on 16-bit data items and creates a 32-bit
checksum.
• The 8-bit Fletcher is calculated over data octets (bytes) and creates a 16-bit check-
sum. The calculation is done modulo 256 (28), which means the intermediate results
are divided by 256 and the remainder is kept.
• The algorithm uses two accumulators, L and R. The first simply adds data items
together; the second adds a weight to the calculation.
• The 16-bit Fletcher checksum is similar to the 8-bit Fletcher checksum, but it is
calculated over 16-bit data items and creates a 32-bit checksum. The calculation is
done modulo 65,536.
Adler Checksum

• The Adler checksum is a 32-bit checksum. Figure 10.19 shows a simple algorithm in
flowchart form.
• It is similar to the 16-bit Fletcher with three differences. First, calculation is done on
single bytes instead of 2 bytes at a time.
• Second, the modulus is a prime number (65,521) instead of 65,536.
• Third, L is initialized to 1 instead of 0. It has been proved that a prime modulo has a
better detecting capability in some combinations of data.

DLC Services
11.1 DLC SERVICES
• The data link control (DLC) deals with procedures for communication between two
adjacent nodes—node-to-node communication—no matter whether the link is
dedicated or broadcast. Data link control functions include framing and flow and
error control.

11.1.1 Framing
• Data transmission in the physical layer means moving bits in the form of a signal from
the source to the destination.
• The physical layer provides bit synchronization to ensure that the sender and receiver
use the same bit durations and timing.
• The data-link layer, on the other hand, needs to pack bits into frames, so that each
frame is distinguishable from another.
• Framing in the data-link layer separates a message from one source to a destination
by adding a sender address and a destination address.
Frame Size

• Frames can be of fixed or variable size.


• In fixed-size framing, there is no need for defining the boundaries of the frames; the
size itself can be used as a delimiter.
• In variable-size framing, we need a way to define the end of one frame and the
beginning of the next.
• Historically, two approaches were used for this purpose: a character-oriented
approach and a bit-oriented approach.
Character-Oriented Framing
• In character-oriented (or byte-oriented) framing, data to be carried are 8-bit
characters from a coding system such as ASCII .
• The header, which normally carries the source and destination addresses and other
control information, and the trailer, which carries error detection redundant bits, are
also multiples of 8 bits.
• To separate one frame from the next, an 8-bit (1-byte) flag is added at the beginning
and the end of a frame.

• In byte stuffing (or character stuffing), a special byte is added to the data section of
the frame when there is a character with the same pattern as the flag.
• The data section is stuffed with an extra byte. This byte is usually called the escape
character (ESC) and has a predefined bit pattern. Whenever the receiver encounters
the ESC character, it removes it from the data section and treats the next character as
data, not as a delimiting flag.
• Byte stuffing by the escape character allows the presence of the flag in the data
section of the frame.
• The receiver removes the escape character, but keeps the next byte, which is
incorrectly interpreted as the end of the frame. If the escape character is part of the
text, an extra one is added to show that the second one is part of the text.
Bit-Oriented Framing

• In bit-oriented framing, the data section of a frame is a sequence of bits to be


interpreted by the upper layer as text, graphic, audio, video, and so on.
• However, in addition to headers, we still need a delimiter to separate one frame from
the other. Most protocols use a special 8-bit pattern flag, 01111110, as the delimiter
to define the beginning and the end of the frame.

• If the flag pattern appears in the data, we need to somehow inform the receiver that
this is not the end of the frame. We do this by stuffing 1 single bit (instead of 1 byte)
to prevent the pattern from looking like a flag. The strategy is called bit stuffing.
• Bit stuffing is the process of adding one extra 0 whenever five consecutive 1s follow a
0 in the data, so that the receiver does not mistake the pattern 0111110 for a flag.
11.1.2 Flow and Error Control
One of the responsibilities of the data-link control sublayer is flow and error control at the
data-link layer.

Flow Control

• In communication at the data-link layer, we are dealing with four entities: network
and data-link layers at the sending node and network and data-link layers at the
receiving node.
• Although we can have a complex relationship with more than one producer and
consumer, we ignore the relationships between networks and data-link layers and
concentrate on the relationship between two data-link layers.

Buffers

• Although flow control can be implemented in several ways, we normally use two
buffers; one at the sending data-link layer and the other at the receiving data-link
layer.
• A buffer is a set of memory locations that can hold packets at the sender and
receiver.
• The flow control communication can occur by sending signals from the consumer to
the producer. When the buffer of the receiving data-link layer is full, it informs the
sending data-link layer to stop pushing frames.
Error Control

• The underlying technology at the physical layer is not fully reliable, we need to
implement error control at the data-link layer to prevent the receiving node from
delivering corrupted packets to its network layer.
• Error control at the data-link layer is normally very simple and implemented using
one of the following two methods.
➢ In the first method, if the frame is corrupted, it is silently discarded; if it is not
corrupted, the packet is delivered to the network layer. This method is used mostly in
wired LANs such as Ethernet.
➢ In the second method, if the frame is corrupted, it is silently discarded; if it is not
corrupted, an acknowledgment is sent to the sender.

Combination of Flow and Error Control


• The acknowledgment that is sent for flow control can also be used for error control
to tell the sender the packet has arrived uncorrupted.
• A frame that carries an acknowledgment is normally called an ACK to distinguish it
from the data frame.
11.1.3 Connectionless and Connection-Oriented
A DLC protocol can be either connectionless or connection-oriented.
Connectionless Protocol

• In a connectionless protocol, frames are sent from one node to the next without any
relationship between the frames; each frame is independent.
• Note that the term connectionless here does not mean that there is no physical
connection (transmission medium) between the nodes; it means that there is no
connection between frames.
• The frames are not numbered and there is no sense of ordering. Most of the data-
link protocols for LANs are connectionless protocols.
Connection-Oriented Protocol

• In a connection-oriented protocol, a logical connection should first be established


between the two nodes.
• After all frames that are somehow related to each other are transmitted, the logical
connection is terminated.In this type of communication, the frames are numbered
and sent in order.
• If they are not received in order, the receiver needs to wait until all frames belonging
to the same set are received and then deliver them in order to the network layer.
• Connection oriented protocols are rare in wired LANs, but we can see them in some
point-to-point protocols, some wireless LANs, and some WANs.

11.2 DATA-LINK LAYER PROTOCOLS


• The behavior of a data-link-layer protocol can be better shown as a finite state
machine (FSM).
• An FSM is thought of as a machine with a finite number of states.The machine is
always in one of the states until an event occurs.
• Each event is associated with two reactions: defining the list of actions to be
performed and determining the next state.
• One of the states must be defined as the initial state, the state in which the machine
starts when it turns on.
• In Figure 11.6, we show an example of a machine using FSM. We have used rounded-
corner rectangles to show states, colored text to show events, and regular black text
to show actions. A horizontal line is used to separate the event from the actions,
although later we replace the horizontal line with a slash. The arrow shows the
movement to the next state.
11.2.1 Simple Protocol
• Our first protocol is a simple protocol with neither flow nor error control. We assume
that the receiver can immediately handle any frame it receives.

• The data-link layer at the sender gets a packet from its network layer, makes a frame
out of it, and sends the frame.
• The data-link layer at the receiver receives a frame from the link, extracts the packet
from the frame, and delivers the packet to its network layer.
• The data-link layers of the sender and receiver provide transmission services for their
network layers.
FSMs

• Each FSM has only one state, the ready state. The sending machine remains in the
ready state until a request comes from the process in the network layer.
• When this event occurs, the sending machine encapsulates the message in a frame
and sends it to the receiving machine.
• The receiving machine remains in the ready state until a frame arrives from the
sending machine.
• When this event occurs, the receiving machine decapsulates the message out of the
frame and delivers it to the process at the network layer.
11.2.2 Stop-and-Wait Protocol

• Our second protocol is called the Stop-and-Wait protocol, which uses both flow and
error control.
• The sender sends one frame at a time and waits for an acknowledgment before
sending the next one.
• To detect corrupted frames, we need to add a CRC to each data frame. When a frame
arrives at the receiver site, it is checked. If its CRC is incorrect, the frame is corrupted
and silently discarded.
• Every time the sender sends a frame, it starts a timer. If an acknowledgment arrives
before the timer expires, the timer is stopped and the sender sends the next frame .
• If the timer expires, the sender resends the previous frame, assuming that the frame
was either lost or corrupted.

FSMs
Figure shows the FSMs for our primitive Stop-and-Wait protocol.
Sender States

• The sender is initially in the ready state, but it can move between the ready and
blocking state.
Ready State.

• When the sender is in this state, it is only waiting for a packet from the network layer.
If a packet comes from the network layer, the sender creates a frame, saves a copy of
the frame, starts the only timer and sends the frame. The sender then moves to the
blocking state.
Blocking State.

• When the sender is in this state, three events can occur:


a) If a time-out occurs, the sender resends the saved copy of the frame and restarts the
timer.
b) If a corrupted ACK arrives, it is discarded.
c) If an error-free ACK arrives, the sender stops the timer and discards the saved copy
of the frame. It then moves to the ready state.
Receiver

• The receiver is always in the ready state. Two events may occur:
a) If an error-free frame arrives, the message in the frame is delivered to the network
layer and an ACK is sent.
b) If a corrupted frame arrives, the frame is discarded.
Sequence and Acknowledgment Numbers

• Duplicate packets,as much as corrupted packets, need to be avoided.


• We need to add sequence numbers to the data frames and acknowledgment
numbers to the ACK frames.
• However, numbering in this case is very simple. Sequence numbers are 0, 1, 0, 1, 0, 1,
. . . ; the acknowledgment numbers can also be 1, 0, 1, 0, 1, 0, ...
• An acknowledgment number always defines the sequence number of the next frame
to receive.

11.2.3 Piggybacking
• To make the communication more efficient, the data in one direction is piggybacked
with the acknowledgment in the other direction.
• In other words, when node A is sending data to node B, Node A also acknowledges
the data received from node B. Because piggybacking makes communication at the
datalink layer more complicated, it is not a common practice.

11.3 HDLC
High-level Data Link Control (HDLC) is a bit-oriented protocol for communication over point-
to-point and multipoint links. It implements the Stop-and-Wait protocol.

11.3.1 Configurations and Transfer Modes


• HDLC provides two common transfer modes that can be used in different
configurations: normal response mode (NRM) and asynchronous balanced mode
(ABM).
• In normal response mode (NRM), the station configuration is unbalanced. We have
one primary station and multiple secondary stations. A primary station can send
commands; a secondary station can only respond.

• In ABM, the configuration is balanced. The link is point-to-point, and each station can
function as a primary and a secondary (acting as peers).

11.3.2 Framing
• HDLC defines three types of frames: information frames(I-frames), supervisory
frames (S-frames), and unnumbered frames (U-frames).
• Each type of frame serves as an envelope for the transmission of a different type of
message.
• I-frames are used to data-link user data and control information relating to user data
(piggy-backing).
• S-frames are used only to transport control information.
• U-frames are reserved for system management.
• Each frame in HDLC may contain up to six fields(as shown in fig.11.6): a beginning
flag field, an address field, a control field, an information field, a frame check
sequence (FCS) field, and an ending flag field.

The fields and their use in different frame types.

• Flag field. This field contains synchronization pattern 01111110, which identifies both
the beginning and the end of a frame.
• Address field. This field contains the address of the secondary station. If a primary
station created the frame, it contains a to address. If a secondary station creates the
frame, it contains a from address. The address field can be one byte or several bytes
long, depending on the needs of the network.
• Control field. The control field is one or two bytes used for flow and error control.The
interpretation of bits are discussed later.
• Information field. The information field contains the user’s data from the network
layer or management information. Its length can vary from one network to another.
• FCS field. The frame check sequence (FCS) is the HDLC error detection field. It can
contain either a 2- or 4-byte CRC.
The control field determines the type of frame and defines its functionality.

Control Field for I-Frames

• I-frames are designed to carry user data from the network layer. The subfields in the
control field are used to define these functions.
• The first bit defines the type. If the first bit of the control field is 0, this means the
frame is an I-frame. The next 3 bits, called N(S), define the sequence number of the
frame.
• The last 3 bits, called N(R), correspond to the acknowledgment number when
piggybacking is used. The single bit between N(S) and N(R) is called the P/F bit,a
single bit with a dual purpose.
• It has meaning only when it is set (bit = 1) and can mean poll or final. It means poll
when the frame is sent by a primary station to a secondary.
• It means final when the frame is sent by a secondary to a primary.
Control Field for S-Frames

• Supervisory frames are used for flow and error control whenever piggybacking is
either impossible or inappropriate.
• If the first 2 bits of the control field are 10, this means the frame is an S-frame. The
last 3 bits, called N(R),correspond to the acknowledgment number (ACK) or negative
acknowledgment number (NAK), depending on the type of S-frame.
• The 2 bits called code are used to define the type of S-frame itself. With 2 bits, we
can have four types of S-frames, as described below:
➢ Receive ready (RR). If the value of the code subfield is 00, it is an RR S-frame.This kind
of frame acknowledges the receipt of a safe and sound frame or group of frames. In
this case, the value of the N(R) field defines the acknowledgment number.
➢ Receive not ready (RNR). If the value of the code subfield is 10, it is an RNR S-frame.
This kind of frame is an RR frame with additional functions. It acknowledges the
receipt of a frame or group of frames, and it announces that the receiver is busy and
cannot receive more frames. It acts as a kind of congestion-control mechanism by
asking the sender to slow down. The value of N(R) is the acknowledgment number.
➢ Reject (REJ). If the value of the code subfield is 01, it is an REJ S-frame. This is a NAK
frame, but not like the one used for Selective Repeat ARQ. It is a NAK that can be
used in Go-Back-N ARQ to improve the efficiency of the process by informing the
sender, before the sender timer expires, that the last frame is lost or damaged. The
value of N(R) is the negative acknowledgment number.
➢ Selective reject (SREJ). If the value of the code subfield is 11, it is an SREJ S-frame.
This is a NAK frame used in Selective Repeat ARQ. Note that the HDLC Protocol uses
the term selective reject instead of selective repeat. The value of N(R) is the negative
acknowledgment number.
Control Field for U-Frames

• Unnumbered frames are used to exchange session management and control


information between connected devices.
• U-frames contain an information field, but one used for system management
information, not user data.
• Much of the information carried by U-frames is contained in codes included in the
control field. U-frame codes are divided into two sections: a 2-bit prefix before the
P/F bit and a 3-bit suffix after the P/F bit.

11.4 POINT-TO-POINT PROTOCOL (PPP)


One of the most common protocols for point-to-point access is the Point-to-Point Protocol
(PPP).

11.4.1 Services
The designers of PPP have included several services to make it suitable for a point-to-point
protocol.
Services Provided by PPP

• PPP defines the format of the frame to be exchanged between devices. It also
defines how two devices can negotiate the establishment of the link and the
exchange of data.
• PPP is designed to accept payloads from several network layers (not only IP).
• Multilink PPP, provides connections over multiple links. One interesting feature of
PPP is that it provides network address configuration.
Services Not Provided by PPP

• PPP does not provide flow control. PPP has a very simple mechanism for error
control.
• A CRC field is used to detect errors. If the frame is corrupted, it is silently discarded;
the upper-layer protocol needs to take care of the problem.
• Lack of error control and sequence numbering may cause a packet to be received out
of order. PPP does not provide a sophisticated addressing mechanism to handle
frames in a multipoint configuration.
11.4.2 Framing
PPP uses a character-oriented (or byte-oriented) frame. Figure 11.20 shows the format of a
PPP frame. The description of each field follows:

• Flag. A PPP frame starts and ends with a 1-byte flag with the bit pattern 01111110.

• Address. The address field in this protocol is a constant value and set to 11111111
(broadcast address).
• Control. This field is set to the constant value 00000011 (imitating unnumbered
frames in HDLC). As we will discuss later, PPP does not provide any flow control. Error
control is also limited to error detection.
• Protocol. The protocol field defines what is being carried in the data field: either user
data or other information. This field is by default 2 bytes long, but the two parties
can agree to use only 1 byte.
• Payload field. This field carries either the user data or other information. The data
field is a sequence of bytes with the default of a maximum of 1500 bytes; but this
can be changed during negotiation
• FCS. The frame check sequence (FCS) is simply a 2-byte or 4-byte standard CRC.
Byte Stuffing

• Since PPP is a byte-oriented protocol, the flag in PPP is a byte that needs to be
escaped whenever it appears in the data section of the frame.
• The escape byte is 01111101, which means that every time the flaglike pattern
appears in the data, this extra byte is stuffed to tell the receiver that the next byte is
not a flag. Obviously, the escape byte itself should be stuffed with another escape
byte.
11.4.3 Transition Phases

• A PPP connection goes through phases which can be shown in a transition phase
diagram (see Figure 11.21).
• The transition diagram, which is an FSM, starts with the dead state. In this state,
there is no active carrier (at the physical layer) and the line is quiet.
• When one of the two nodes starts the communication, the connection goes into the
establish state. In this state, options are negotiated between the two parties.
• If the two parties agree that they need authentication, then the system needs to do
authentication; otherwise, the parties can simply start communication.
• Data transfer takes place in the open state. When a connection reaches this state, the
exchange of data packets can be started. The connection remains in this state until
one of the endpoints wants to terminate the connection.
• In this case, the system goes to the terminate state. The system remains in this state
until the carrier (physical-layer signal) is dropped, which moves the system to the
dead state again.
11.4.4 Multiplexing

• Three sets of protocols are defined to make PPP powerful: the Link Control Protocol
(LCP), two Authentication Protocols (APs), and several Network Control Protocols
(NCPs).
• A PPP packet can carry data from one of these protocols in its data field, as shown in
Figure 11.22.
Link Control Protocol

• The Link Control Protocol (LCP) is responsible for establishing, maintaining,


configuring, and terminating links.
• It also provides negotiation mechanisms to set options between the two endpoints.
• All LCP packets are carried in the payload field of the PPP frame with the protocol
field set to C021 in hexadecimal (see Figure 11.23).

The code field defines the type of LCP packet. There are 11 types of packets, as shown in
Table 11.1.
• There are three categories of packets.
• The first category, comprising the first four packet types, is used for link configuration
during the establish phase.
• The second category, comprising packet types 5 and 6, is used for link termination
during the termination phase.
• The last five packets are used for link monitoring and debugging.
• The ID field holds a value that matches a request with a reply.
• The length field defines the length of the entire LCP packet. The information field
contains information, such as options, needed for some LCP packets.
• The information field is divided into three fields: option type, option length, and
option data. We list some of the most common options in Table 11.2.

Authentication Protocols

• Authentication means validating the identity of a user who needs to access a set of
resources.
• PPP has created two protocols for authentication: Password Authentication Protocol
and Challenge Handshake Authentication Protocol.
PAP
The Password Authentication Protocol (PAP) is a simple authentication procedure with a
two-step process:
a. The user who wants to access a system sends an authentication identification and a
password.
b. The system checks the validity of the identification and password and either accepts or
denies connection.

• When a PPP frame is carrying any PAP packets, the value of the protocol field is
0xC023.
• The three PAP packets are authenticate-request, authenticate-ack, and authenticate-
nak.
• The first packet is used by the user to send the user name and password.
• The second is used by the system to allow access.
• The third is used by the system to deny access.

CHAP
The Challenge Handshake Authentication Protocol (CHAP) is a three-way handshaking
authentication protocol that provides greater security than PAP. In this method, the
password is kept secret; it is never sent online.
a. The system sends the user a challenge packet containing a challenge value, usually a few
bytes.
b. The user applies a predefined function that takes the challenge value and the user’s own
password and creates a result. The user sends the result in the response packet to the
system.
c. The system does the same. It applies the same function to the password of the user and
the challenge value to create a result. If the result created is the same as the result sent in
the response packet, access is granted; otherwise, it is denied.
• CHAP packets are encapsulated in the PPP frame with the protocol value C223 in
hexadecimal.
• There are four CHAP packets: challenge, response, success, and failure. The first
packet is used by the system to send the challenge value. The second is used by the
user to return the result of the calculation. The third is used by the system to allow
access to the system. The fourth is used by the system to deny access to the system.
Network Control Protocols

• PPP has defined a specific Network Control Protocol for each network protocol.
• For example, IPCP (Internet Protocol Control Protocol) configures the link for carrying
IP data packets.
• Note that none of the NCP packets carry network-layer data; they just configure the
link at the network layer for the incoming data.
IPCP
One NCP protocol is the Internet Protocol Control Protocol (IPCP). This protocol configures
the link used to carry IP packets in the Internet.

IPCP defines seven packets, distinguished by their code values, as shown in Table 11.3.
Other Protocols

• There are other NCP protocols for other network-layer protocols.


• The OSI Network Layer Control Protocol has a protocol field value of 8023; the Xerox
NS IDP Control Protocol has a protocol field value of 8025; and so on.
Data from the Network Layer

• After the network-layer configuration is completed by one of the NCP protocols, the
users can exchange data packets from the network layer.
• There are different protocol fields for different network layers. For example, if PPP is
carrying data from the IP network layer, the field value is 0021.
• If PPP is carrying data from the OSI network layer, the value of the protocol field is
0023, and so on. Figure 11.27 shows the frame for IP.

Multilink PPP

• Multilink PPP, a logical PPP frame is divided into several actual PPP frames. A
segment of the logical frame is carried in the payload of an actual PPP frame, as
shown in Figure 11.28.
• To show that the actual PPP frame is carrying a fragment of a logical PPP frame, the
protocol field is set to (003d)16. This new development adds complexity.
• For example, a sequence number needs to be added to the actual PPP frame to show
a fragment’s position in the logical frame.
Example 11.7
Let us go through the phases followed by a network layer packet as it is transmitted through
a PPP connection. Figure 11.29 shows the steps. For simplicity, we assume unidirectional
movement of data from the user site to the system site (such as sending an e-mail through
an ISP).

• The first two frames show link establishment. We have chosen two options (not
shown in the figure): using PAP for authentication and suppressing the address
control fields. Frames 3 and 4 are for authentication. Frames 5 and 6 establish the
network layer connection using IPCP.
• The next several frames show that some IP packets are encapsulated in the PPP
frame. The system (receiver) may have been running several network layer protocols,
but it knows that the incoming data must be delivered to the IP protocol because the
NCP protocol used before the data transfer was IPCP.
• After data transfer, the user then terminates the data-link connection, which is
acknowledged by the system. Of course the user or the system could have chosen to
terminate the network-layer IPCP and keep the data-link layer running if it wanted to
run another NCP protocol.

12.1 RANDOM ACCESS


• In random-access or contention methods, no station is superior to another station
and none is assigned control over another.
• Each station can transmit when it desires on the condition that it follows the
predefined procedure, including testing the state of the medium.
• Two feature,first, there is no scheduled time for a station to transmit. Transmission is
random among the stations.
• Second, no rules specify which station should send next. Stations compete with one
another to access the medium. That is why these methods are also called random
access or contention methods.
• If more than one station tries to send, there is an access conflict—collision—and the
frames will be either destroyed or modified. To avoid access conflict or to resolve it
when it happens, each station follows a procedure
• The random-access methods known as ALOHA, which used a very simple procedure
called multiple access (MA). This was called carrier sense multiple access (CSMA).
• This method later evolved into two parallel methods: carrier sense multiple access
with collision detection (CSMA/CD), which tells the station what to do when a
collision is detected, and carrier sense multiple access with collision avoidance
(CSMA/CA), which tries to avoid the collision.
12.1.1 ALOHA

• ALOHA, the earliest random access method


• It is obvious that there are potential collisions in this arrangement. The medium is
shared between the stations.
• When a station sends data, another station may attempt to do so at the same time.
The data from the two stations collide and become garbled.
Pure ALOHA

• The original ALOHA protocol is called pure ALOHA. This is a simple but elegant
protocol.
• The idea is that each station sends a frame whenever it has a frame to send.
However, since there is only one channel to share, there is the possibility of collision
between frames from different stations.
• The pure ALOHA protocol relies on acknowledgments from the receiver. When a
station sends a frame, it expects the receiver to send an acknowledgment. If the
acknowledgment does not arrive after a time-out period, the station assumes that
the frame (or the acknowledgment) has been destroyed and resends the frame
• Pure ALOHA dictates that when the time-out period passes, each station waits a
random amount of time before resending its frame. The randomness will help avoid
more collisions. We call this time the backoff time TB.
• Pure ALOHA has a second method to prevent congesting the channel with
retransmitted frames. After a maximum number of retransmission attempts Kmax, a
station must give up and try later.

• The time-out period is equal to the maximum possible round-trip propagation delay,
which is twice the amount of time required to send a frame between the two most
widely separated stations (2 × Tp).
• The formula for TB depends on the implementation. One common formula is the
binary exponential backoff. In this method, for each retransmission, a multiplier R = 0
to 2K − 1 is randomly chosen and multiplied by Tp or Tfr to find TB. The value of Kmax
is usually chosen as 15.

Vulnerable time
• The vulnerable time, the length of time in which there is a possibility of collision. We
assume that the stations send fixed-length frames with each frame taking Tfr seconds
to send.

• Station B starts to send a frame at time t. Station A has started to send its frame after
t − Tfr. This leads to a collision between the frames from station B and station A.
• On the other hand, suppose that station C starts to send a frame before time t + Tfr.
Here, there is also a collision between frames from station B and station C.
Pure ALOHA vulnerable time=2×Tfr
Example 12.2
A pure ALOHA network transmits 200-bit frames on a shared channel of 200 kbps. What is
the requirement to make this frame collision-free?
Solution
Average frame transmission time Tfr is 200 bits/200 kbps or 1 ms. The vulnerable time is 2 ×
1 ms = 2 ms. This means no station should send later than 1 ms before this station starts
transmission and no station should start sending during the period (1 ms) that this station is
sending.
Throughput

• The throughput for pure ALOHA is S=G×e-2G.


• The maximum throughput Smax=1/(2e)=0.184 when G=(1/2).

Example 12.3
A pure ALOHA network transmits 200-bit frames on a shared channel of 200 kbps. What is
the throughput if the system (all stations together) produces
a. 1000 frames per second?
b. 500 frames per second?
c. 250 frames per second?
Solution
The frame transmission time is 200/200 kbps or 1 ms.
a. If the system creates 1000 frames per second, or 1 frame per millisecond, then G = 1. In
this case S = G × e−2G = 0.135 (13.5 percent). This means that the throughput is 1000 ×
0.135 = 135 frames. Only 135 frames out of 1000 will probably survive.
b. If the system creates 500 frames per second, or 1/2 frames per millisecond, then G = 1/2.
In this case S = G × e−2G = 0.184 (18.4 percent). This means that the throughput is 500 ×
0.184 = 92 and that only 92 frames out of 500 will probably survive. Note that this is the
maximum throughput case, percentagewise.
c. If the system creates 250 frames per second, or 1/4 frames per millisecond, then G = 1/4.
In this case S = G × e−2G = 0.152 (15.2 percent). This means that the throughput is 250 ×
0.152 = 38. Only 38 frames out of 250 will probably survive.
Slotted ALOHA

• In slotted ALOHA we divide the time into slots of Tfr seconds and force the station to
send only at the beginning of the time slot.

• Because a station is allowed to send only at the beginning of the synchronized time
slot, if a station misses this moment, it must wait until the beginning of the next time
slot.
• The vulnerable time is now reduced to one-half, equal to Tfr.
Slotted ALOHA vulnerable time=Tfr
Throughput

• The throughput for slotted ALOHA is S = G × e-G.


• The maximum throughput Smax = 0.368 when G = 1.
Example 12.4
A slotted ALOHA network transmits 200-bit frames using a shared channel with a 200-kbps
bandwidth. Find the throughput if the system (all stations together) produces
a. 1000 frames per second.

b. 500 frames per second.


c. 250 frames per second.
Solution
This situation is similar to the previous exercise except that the network is using slotted
ALOHA instead of pure ALOHA. The frame transmission time is 200/200 kbps or 1 ms.
a. In this case G is 1. So S = G × e−G = 0.368 (36.8 percent). This means that the throughput is
1000 × 0.0368 = 368 frames. Only 368 out of 1000 frames will probably survive. Note that
this is the maximum throughput case, percentagewise.
b. Here G is 1/2. In this case S = G × e−G = 0.303 (30.3 percent). This means that the
throughput is 500 × 0.0303 = 151. Only 151 frames out of 500 will probably survive.
c. Now G is 1/4. In this case S = G × e−G = 0.195 (19.5 percent). This means that the
throughput is 250 × 0.195 = 49. Only 49 frames out of 250 will probably survive.
12.1.2 CSMA

• Carrier sense multiple access (CSMA) requires that each station first listen to the
medium (or check the state of the medium) before sending. In other words, CSMA is
based on the principle “sense before transmit” or “listen before talk.”
• CSMA can reduce the possibility of collision, but it cannot eliminate it.Stations are
connected to a shared channel (usually a dedicated medium).
• The possibility of collision still exists because of propagation delay; when a station
sends a frame, it still takes time (although very short) for the first bit to reach every
station and for every station to sense it.

Vulnerable Time

• The vulnerable time for CSMA is the propagation time Tp. This is the time needed for
a signal to propagate from one end of the medium to the other.

Persistence Methods
Three methods have been devised to answer these questions: the 1-persistent method, the
nonpersistent method, and the p-persistent method.
I-Persistent

• The I-persistent method is simple and straightforward. In this method, after the
station finds the line idle, it sends its frame immediately (with probability 1).
• This method has the highest chance of collision because two or more stations may
find the line idle and send their frames immediately.
Nonpersistent

• In the nonpersistent method, a station that has a frame to send senses the line. If the
line is idle, it sends immediately. If the line is not idle, it waits a random amount of
time and then senses the line again.
• This method reduces the efficiency of the network because the medium remains idle
when there may be stations with frames to send.
p-Persistent

• The p-persistent method is used if the channel has time slots with a slot duration
equal to or greater than the maximum propagation time.
• The p-persistent approach combines the advantages of the other two strategies. It
reduces the chance of collision and improves efficiency.

12.1.3 CSMA/CD
• Carrier sense multiple access with collision detection (CSMA/CD) augments the
algorithm to handle the collision.
• In this method, a station monitors the medium after it sends a frame to see if the
transmission was successful. If so, the station is finished. If, however, there is a
collision, the frame is sent again.
• Let us look at the first bits transmitted by the two stations involved in the collision.

• At time t1, station A has executed its persistence procedure and starts sending the
bits of its frame.
• At time t2, station C has not yet sensed the first bit sent by A.
• Station C executes its persistence procedure and starts sending the bits in its frame,
which propagate both to the left and to the right.

• The collision occurs sometime after time t2. Station C detects a collision at time t3
when it receives the first bit of A’s frame.
• Station C immediately aborts transmission.
• Station A detects collision at time t4 when it receives the first bit of C’s frame; it also
immediately aborts transmission.
• Looking at the figure, we see that A transmits for the duration t4 − t1; C transmits for
the duration t3 − t2.

Minimum Frame Size


• For CSMA/CD to work, we need a restriction on the frame size. Before sending the
last bit of the frame, the sending station must detect a collision, if any, and abort the
transmission.
Example 12.5
A network using CSMA/CD has a bandwidth of 10 Mbps. If the maximum propagation time
(including the delays in the devices and ignoring the time needed to send a jamming signal,
as we see later) is 25.6 μs, what is the minimum size of the frame?
Solution
The minimum frame transmission time is Tfr = 2 × Tp = 51.2 μs. This means, in the worst
case, a station needs to transmit for a period of 51.2 μs to detect the collision. The minimum
size of the frame is 10 Mbps × 51.2 μs = 512 bits or 64 bytes. This is actually the minimum
size of the frame for Standard Ethernet, as we will see later in the chapter.
Procedure
The flow diagram for CSMA/CD in Figure 12.13. It is similar to the one for the ALOHA
protocol, but there are differences.

• The first difference is the addition of the persistence process.


• The second difference is the frame transmission. In ALOHA, we first transmit the
entire frame and then wait for an acknowledgment. In CSMA/CD, transmission and
collision detection are continuous processes. The station transmits and receives
continuously and simultaneously
• The third difference is the sending of a short jamming signal to make sure that all
other stations become aware of the collision.
Energy Level

• The level of energy in a channel can have three values: zero, normal, and abnormal.
• At the zero level, the channel is idle.
• At the normal level, a station has successfully captured the channel and is sending its
frame.
• At the abnormal level, there is a collision and the level of the energy is twice the
normal level.

Throughput

• The maximum throughput occurs at a different value of G and is based on the


persistence method and the value of p in the p-persistent approach.
• For the 1-persistent method, the maximum throughput is around 50 percent when G
= 1.
• For the nonpersistent method, the maximum throughput can go up to 90 percent
when G is between 3 and 8.
Traditional Ethernet

• The traditional Ethernet was a broadcast LAN that used the 1-persistence method to
control access to the common media.
12.1.4 CSMA/CA

• Carrier sense multiple access with collision avoidance (CSMA/CA) was invented for
wireless networks.
• Collisions are avoided through the use of CSMA/CA’s three strategies: the interframe
space, the contention window, and acknowledgments,
❑ Interframe Space (IFS).

• When an idle channel is found, the station does not send immediately. It waits for a
period of time called the interframe space or IFS.
• Even though the channel may appear idle when it is sensed, a distant station may
have already started transmitting.
• The IFS time allows the front of the transmitted signal by the distant station to reach
this station.
• After waiting an IFS time, if the channel is still idle, the station can send, but it still
needs to wait a time equal to the contention window (described next).
• The IFS variable can also be used to prioritize stations or frame types. For example, a
station that is assigned a shorter IFS has a higher priority.

❑ Contention Window.

• The contention window is an amount of time divided into slots. A station that is
ready to send chooses a random number of slots as its wait time. The number of
slots in the window changes according to the binary exponential backoff strategy.
• The station needs to sense the channel after each time slot. However, if the station
finds the channel busy, it does not restart the process; it just stops the timer and
restarts it when the channel is sensed as idle. This gives priority to the station with
the longest waiting time. See Figure 12.16.
❑ Acknowledgment.

• With all these precautions, there still may be a collision resulting in destroyed data.
In addition, the data may be corrupted during the transmission. The positive
acknowledgment and the time-out timer can help guarantee that the receiver has
received the frame.
Frame Exchange Time Line
1. Before sending a frame, the source station senses the medium by checking the energy
level at the carrier frequency.

a. The channel uses a persistence strategy with backoff until the channel is idle.
b. After the station is found to be idle, the station waits for a period of time called the DCF
interframe space (DIFS); then the station sends a control frame called the request to send
(RTS).
2. After receiving the RTS and waiting a period of time called the short interframe space
(SIFS), the destination station sends a control frame, called the clear to send (CTS), to the
source station. This control frame indicates that the destination station is ready to receive
data.

3. The source station sends data after waiting an amount of time equal to SIFS.
4. The destination station, after waiting an amount of time equal to SIFS, sends an
acknowledgment to show that the frame has been received. Acknowledgment is needed in
this protocol because the station does not have any means to check for the successful arrival
of its data at the destination.
Network Allocation Vector

• When a station sends an RTS frame, it includes the duration of time that it needs to
occupy the channel.
• The stations that are affected by this transmission create a timer called a network
allocation vector (NAV) that shows how much time must pass before these stations
are allowed to check the channel for idleness.
• Each station, before sensing the physical medium to see if it is idle, first checks its
NAV to see if it has expired. Figure 12.17 shows the idea of NAV.
Collision During Handshaking

• Two or more stations may try to send RTS frames at the same time. These control
frames may collide.
• However, because there is no mechanism for collision detection, the sender assumes
there has been a collision if it has not received a CTS frame from the receiver. The
backoff strategy is employed, and the sender tries again.
Hidden-Station Problem

• The solution to the hidden station problem is the use of the handshake frames (RTS
and CTS). Figure 12.17 also shows that the RTS message from B reaches A, but not C.
• However, because both B and C are within the range of A, the CTS message, which
contains the duration of data transmission from B to A, reaches C.
• Station C knows that some hidden station is using the channel and refrains from
transmitting until that duration is over.
CSMA/CA and Wireless Networks

• CSMA/CA was mostly intended for use in wireless networks.

12.2 CONTROLLED ACCESS


In controlled access, the stations consult one another to find which station has the right to
send. A station cannot send unless it has been authorized by other stations.

12.2.1 Reservation
• In the reservation method, a station needs to make a reservation before sending
data. Time is divided into intervals. In each interval, a reservation frame precedes the
data frames sent in that interval.
• If there are N stations in the system, there are exactly N reservation minislots in the
reservation frame. Each minislot belongs to a station. When a station needs to send a
data frame, it makes a reservation in its own minislot. The stations that have made
reservations can send their data frames after the reservation frame.
12.2.2 Polling
• Polling works with topologies in which one device is designated as a primary station
and the other devices are secondary stations.
• All data exchanges must be made through the primary device even when the
ultimate destination is a secondary device.
• The primary device controls the link; the secondary devices follow its instructions.
• The primary device, therefore, is always the initiator of a session (see Figure 12.19).
This method uses poll and select functions to prevent collisions.

Select

• The select function is used whenever the primary device has something to send.
• The primary must alert the secondary to the upcoming transmission and wait for an
acknowledgment of the secondary’s ready status.
• Before sending data, the primary creates and transmits a select (SEL) frame, one field
of which includes the address of the intended secondary.
Poll

• The poll function is used by the primary device to solicit transmissions from the
secondary devices. When the primary is ready to receive data, it must ask (poll) each
device in turn if it has anything to send.
• When the first secondary is approached, it responds either with a NAK frame if it has
nothing to send or with data (in the form of a data frame) if it does.
• If the response is negative (a NAK frame), then the primary polls the next secondary
in the same manner until it finds one with data to send. When the response is
positive (a data frame), the primary reads the frame and returns an acknowledgment
(ACK frame), verifying its receipt.
12.2.3 Token Passing

• In the token-passing method, the stations in a network are organized in a logical ring.
• For each station, there is a predecessor and a successor. The predecessor is the
station which is logically before the station in the ring; the successor is the station
which is after the station in the ring.
• The current station is the one that is accessing the channel now.
• A special packet called a token circulates through the ring.
• The possession of the token gives the station the right to access the channel and
send its data. When a station has some data to send, it waits until it receives the
token from its predecessor.
• It then holds the token and sends its data. When the station has no more data to
send, it releases the token, passing it to the next logical station in the ring.
• Token management is needed for this access method. Stations must be limited in the
time they can have possession of the token.
• The token must be monitored to ensure it has not been lost or destroyed.
• And finally, token management is needed to make low-priority stations release the
token to high-priority stations.
Logical Ring

• In a token-passing network, stations do not have to be physically connected in a ring;


the ring can be a logical one.

• In the physical ring topology, when a station sends the token to its successor, the
token cannot be seen by other stations; the successor is the next one in line.
• The dual ring topology uses a second (auxiliary) ring which operates in the reverse
direction compared with the main ring. The high-speed Token Ring networks called
FDDI (Fiber Distributed Data Interface) and CDDI (Copper Distributed Data Interface)
use this topology.
• In the bus ring topology, also called a token bus, the stations are connected to a
single cable called a bus. They, however, make a logical ring, because each station
knows the address of its successor (and also predecessor for token management
purposes).
• In a star ring topology, the physical topology is a star. There is a hub, however, that
acts as the connector. The wiring inside the hub makes the ring; the stations are
connected to this ring through the two wire connections.

You might also like