Module - I Introduction To Computer Network
Module - I Introduction To Computer Network
Module - I Introduction To Computer Network
B
[Year]
Module - I
Introduction to Computer Network
1.1 Data Communication: When we communicate, we are sharing information. This sharing can be local or
remote. Between individuals, local communication usually occurs face to face, while remote communication
takes place over distance.
Data refers to the information present in whatever form is agreed upon by the creating and using the
data.
The effectiveness of a data communications system depends on four fundamental characteristics:
delivery, accuracy, timeliness, and jitter.
1. Delivery. The system must deliver data to the correct destination. Data must be received by the intended
device or user and only by that device or user.
2. Accuracy. The system must deliver the data accurately. Data that have been altered in transmission and
left uncorrected are unusable.
3. Timeliness. The system must deliver data in a timely manner. Data delivered late are useless. 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. Jitte r. Jitter refers to the variation in the packet arrival time. It is the uneven delay in the delivery of
audio or video packets
1.1.1 Components:
A data communications system has five components.
1. Message. The message is the information (data) to be communicated. Popular forms of information
include text, numbers, pictures, audio, and video.
2. Sender. The sender is the device that sends the data message. It can be a computer, workstation, telephone
handset, video camera, and so on.
3. Receiver. The receiver is the device that receives the message. It can be a computer, workstation, telephone
handset, television, and so on.
4. Transmission medium. The transmission medium is the physical path by which a message travels from sender
to receiver. Some examples of transmission media include twisted-pair wire, coaxial cable, fiber-optic cable,
and radio waves
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.
Information today comes in different forms such as text, numbers, images, audio, and video
Half-Duplex:
In half-duplex mode, each station can both transmit and receive, but not at the same time (Fig b).
When one device is sending, the other can only receive, and vice versa.
In a half-duplex transmission, the entire capacity of a channel is taken over by whichever of the two
devices is transmitting at the time. Walkie-talkies and CB (citizens band) radios are both half-duplex
systems.
The half-duplex mode is used in cases where there is no need for communication in both directions at
the same time; the entire capacity of the channel can be utilized for each direction.
Full-Duplex:
In full-duplex both stations can transmit and receive simultaneously (see Figure c).
The full-duplex mode is like a two-way street with traffic flowing in both directions at the same time.
In full-duplex mode, signals going in one direction share the capacity of the link with signals going in
the other direction.
This sharing can occur in two ways: A) Either the link must contain two physically separate
transmission paths, one for sending and the other for receiving;
B) The capacity of the channel is divided between signals traveling in both directions.
1.2 NETWORKS
A network is the interconnection of set of devices capable of communication. A device can be a host such as
computer, printer, or any other device capable of sending and/or receiving data generated by other nodes on the
network.
Performance:
Performance can be measured in many ways, including transit time and response time.
Transit time is the amount of time required for a message to travel from one device to another.
Response time is the elapsed time between an inquiry and a response.
The performance of a network depends on a number of factors, including the number of users, the type
of transmission medium, the capabilities of the connected hardware, and the efficiency of the software.
Performance is often evaluated by two networking metrics: throughput and delay. We often need more
throughput and less delay.
Reliability:
In addition to accuracy of delivery, network reliability is measured by the frequency of failure, the time
it takes a link to recover from a failure, and the network's robustness in a catastrophe.
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.
Type of Connection
A network is two or more devices connected through links. A link is a communications pathway that
transfers data from one device to another.
For communication to occur, two devices must be connected in some way to the same link at the same
time. There are two possible types of connections A) point-to-point B) multipoint.
Point-to-Point :
A point-to-point connection provides a dedicated link between two devices. The entire capacity of the
link is reserved for transmission between those two devices.
Most point-to-point connections use an actual length of wire or cable to connect the two ends, but other
options, such as microwave or satellite links, are also possible.
Multipoint
A multipoint (also called multidrop) connection is one in which more than two specific devices share a
single link.
In a multipoint environment, the capacity of the channel is shared, either spatially or temporally. If
several devices can use the link simultaneously, it is a spatially shared connection. If users must take
turns, it is a timeshared connection.
The term physical topology refers to the way in which a network is laid out physically. One or more devices
connect to a link; two or more links form a topology. The topology of a network is the geometric representation
of the relationship of all the links and linking devices (usually called nodes) to one another. There are four basic
topologies possible: mesh, star, bus, and ring
Advantages:
1. The use of dedicated links guarantees that each connection can carry its own data load, thus
eliminating the traffic problems that can occur when links must be shared by multiple devices.
2. A mesh topology is robust. If one link becomes unusable, it does not incapacitate the entire system.
3. There is the advantage of privacy or security. When every message travels along a dedicated line, only the
intended recipient sees it. Physical boundaries prevent other users from gaining access to messages.
4. Point-to-point links make fault identification and fault isolation easy. Traffic can be routed to avoid links
with suspected problems. This facility enables the network manager to discover the precise location of the fault
and aids in finding its cause and solution.
Disadvantages:
1. Disadvantage of a mesh are related to the amount of cabling because every device must be connected to
every other device, installation and reconnection are difficult.
2. Second, the sheer bulk of the wiring can be greater than the available space (in walls, ceilings, or floors) can
accommodate. Finally, the hardware required to connect each link (I/O ports and cable) can be prohibitively
expensive.
Star Topology:
In a star topology, each device has a dedicated point-to-point link only to a central controller, usually
called a hub.
The devices are not directly linked to one another. Unlike a mesh topology, a star topology does not
allow direct traffic between devices.
The controller acts as an exchange: If one device wants to send data to another, it sends the data to the
controller, which then relays the data to the other connected device .
A star topology is less expensive than a mesh topology. In a star, each device needs only one link and
one I/O port to connect it to any number of others.
Disadvantage:
The dependency of the whole topology on one single point, the hub. If the hub goes down, the whole
system is dead. Although a star requires far less cable than a mesh, each node must be linked to a
central hub. For this reason, often more cabling is required in a star than in some other topologies (such
as ring or bus).
Disadvantage:
Dependency of the whole topology on one single point, the hub. If the hub goes down, the whole system
is dead. Although a star requires far less cable than a mesh, each node must be linked to a central hub.
For this reason, often more cabling is required in a star than in some other topologies (such as ring or
bus).
Bus Topology:
The preceding examples all describe point-to-point connections. A bus topology, on the other hand, is
multipoint. One long cable acts as a backbone to link all the devices in a network
Nodes are connected to the bus cable by drop lines and taps.
A drop line is a connection running between the device and the main cable.
A tap is a connector that either splices into the main cable or punctures the sheathing of a cable to create
a contact with the metallic core.
As a signal travels along the backbone, some of its energy is transformed into heat. Therefore, it
becomes weaker and weaker as it travels farther and farther. For this reason there is a limit on the
number of taps a bus can support and on the distance between those taps.
Ring Topology:
In a ring topology, each device has a dedicated point-to-point connection with only the two devices on
either side of it.
A signal is passed along the ring in one direction, from device to device, until it reaches its destination.
Each device in the ring incorporates a repeater.
When a device receives a signal intended for another device, its repeater regenerates the bits and passes
them along.
Each device is linked to only its immediate neighbors (either physically or logically).
To add or delete a device requires changing only two connections. The only constraints are media and
traffic considerations (maximum ring length and number of devices). In addition, fault isolation is
simplified.
Generally in a ring, a signal is circulating at all times. If one device does not receive a signal within a
specified period, it can issue an alarm.
The alarm alerts the network operator to the problem and its location.
Unidirectional traffic can be a disadvantage. In a simple ring, a break in the ring (such as a disabled
station) can disable the entire network. This weakness can be solved by using a dual ring or a switch
capable of closing off the break.
Ring topology was prevalent when IBM introduced its local-area network Token Ring. Today, the need
for higher-speed LANs has made this topology less popular.
.
1.3.2 Wide Area Network :
Point-to-Point WAN
A point-to-point WAN is a network that connects two communicating devices through a trans- mission
media (cable or air).
Figure 1.9 shows an example of a point-to-point WAN.
Switched WAN :
A switched WAN is a network with more than two ends.
A switched WAN, 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 by switches.
Internetwork
When two or more networks are connected, they make an internetwork, or internet.
To make the communication between employees at different offices possible, the management leases a
point-to-point dedicated WAN from a service provider, such as a telephone company, and connects the
two LANs. Figure 1.11 shows this internet.
When a host in the west coast office sends a message to another host in the same office, the router
blocks the message, but the switch directs the message to the destination.
On the other hand, when a host on the west coast sends a message to a host on the east coast, router R1
routes the packet to router R2, and the packet reaches the destination.
1.3.3 Switching
An internet is a s witched network in which a switch connects at least two links together.
A switch needs to forward data from a network to another network when required. The two most
common types of switched networks are circuit-switched and packet-switched networks.
Circuit-Switched Network
In a circuit-s witched network, a dedicated connection, called a circuit, is always available between the
two end systems; the switch can only make it active or inactive.
Figure 1.13 shows a very simple switched network that connects four telephones to each end. We have
used telephone sets instead of computers as an end system because circuit switching was very common
in telephone networks in the past, although part of the telephone network today is a packet-switched
network.
In Figure 1.13, the four telephones at each side are connected to a switch.
The switch connects a telephone set at one side to a telephone set at the other side.
The thick line connecting two switches is a high-capacity communication line that can handle four voice
communications at the same time; the capacity can be shared between all pairs of telephone sets.
The switches used have forwarding tasks but no storing capability.
Let us look at two cases. In the first case, all telephone sets are busy; four people at one site are talking
with four people at the other site; the capacity of the thick line is fully used.
In the second case, only one telephone set at one side is connected to a telephone set at the other side;
only one-fourth of the capacity of the thick line is used.
This means that a circuit-switched network is efficient only when it is working at its full capacity; most
of the time, it is inefficient because it is working at partial capacity.
The reason that we need to make the capacity of the thick line four times the capacity of each voice line
is that we do not want communication to fail when all telephone sets at one side want to be connected
with all telephone sets at the other side.
Packet-Switched Network
In a computer network, the communication between the two ends is done in blocks of data called
packets.
We see the exchange of individual data packets between the two computers.
This allows us to make the switches function for both storing and forwarding because a packet is an
independent entity that can be stored and sent later.
Figure 1.14 shows a small packet-switched network that connects four computers at one site to four
computers at the other site.
A router in a packet-switched network has a queue that can store and forward the packet.
Assume that the capacity of the thick line is only twice the capacity of the data line connecting the
computers to the routers. If only two computers (one at each site) need to communicate with each other,
there is no waiting for the packets.
However, if packets arrive at one router when the thick line is already working at its full capacity, the
packets should be stored and forwarded in the order they arrived.
The two simple examples show that a packet-switched network is more efficient than a circuit switched
network, but the packets may encounter some delays.
1.3.4 The Internet
An internet (note the lowercase i) is two or more networks that can communicate with each other. The
most notable internet is called the Internet (uppercase I )
Composed of thousands of inter connected networks.
Figure 1.15 shows a conceptual (not geographical) view of the Internet.
The figure shows the Internet as several backbones, provider networks, and customer networks. At the
top level, the backbones are large networks owned by some communication companies such as Sprint,
Verizon (MCI), AT&T, and NTT.
The back bone networks are connected through some complex switching systems, called peering points.
At the second level, there are smaller networks, called provider networks that use the services of the
backbones for a fee.
Network Models:
2.1 PROTOCOL LAYERING
In data communication and networking, a protocol defines the rules that both the sender and receiver
and all intermediate devices need to follow to be able to communicate effectively.
When communication is simple, we may need only one simple protocol; when the communication is
complex, we may need to divide the task between different layers, in which case we need a protocol at
each layer, or protocol layering.
2.1.1 Scenarios
Let us develop two simple scenarios to better understand the need for protocol layering.
First Scenario
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, as shown in Figure.
Second Scenario
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. However, they do
not want their ideas to be revealed by other people if the letters are intercepted.
They agree on an encryption/decryption technique
. The sender of the letter encrypts it to make it unreadable by an intruder; the receiver of the letter
decrypts it to get the original letter, but for the moment we assume that Maria and Ann use one
technique that makes it hard to decrypt the letter if one does not have the key for doing so.
Now communication between Maria and Ann takes place in three layers, as shown in Figure.
We assume that Ann and Maria each have three machines (or robots) that can perform the task at each
layer.
we assume that we want to use the suite in a small internet made up of three LANs (links), each with a
link- layer switch.
We also assume that the links are connected by one router, as shown in Figure 2.5.
Using logical connections makes it easier for us to think about the duty of each layer.
As the figure shows, the duty of the application, transport, and network layers is end-to-end.
The duty of the data- link and physical layers is hop-to-hop, in which a hop is a host or router.
The domain of duty of the top three layers is the internet, and the domain of duty of the two lower layers
is the link. Another way of thinking of the logical connections is to think about the data unit created
from each layer.
In the top three layers, the data unit (packets) should not be changed by any router or link-layer switch.
In the bottom two layers, the packet created by the host is changed only by the routers, not by the link-
layer switches.
Below figure shows the second principle discussed previously for protocol layering. We show the
identical objects below each layer related to each device.
Data-link Layer
An internet is made up of several links connected by routers.
There may be several overlapping sets of links that a datagram can travel from the host to the
destination.
The routers are responsible for choosing the best links.
when the next link to travel is determined by the router, the data- link layer is responsible for taking the
datagram and moving it across the link.
The link can be a wired LAN with a link- layer switch, a wireless LAN, a wired WAN, or a wireless
WAN.
TCP/IP does not define any specific protocol for the data-link layer. It supports all the standard and
proprietary protocols.
Any protocol that can take the datagram and carry it through the link suffices for the network layer.
The data-link layer takes a datagram and encapsulates it in a packet called frame.
Some link- layer protocols provide complete error detection and correction, some provide only error
correction.
Network Layer:
Network layer is responsible for host-to-host communication and routing the packet through possible
routes.
The network layer in the Internet includes the main protocol, Internet Protocol (IP), that defines the
format of the packet, called a datagram at the network layer.
Application Layer
As Figure 2.6 shows, the logical connection between the two application layers is end to-end.
The two application layers exchange messages between each other as though there were a bridge
between the two layers.
Communication at the application layer is between two processes (two programs running at this layer).
To communicate, a process sends a request to the other process and receives a response.
The application layer in the Internet includes many predefined protocols, but a user can also create a pair
of processes to be run at the two hosts.
The Hypertext Transfer Protocol (HTTP) is a vehicle for accessing the World Wide Web (WWW).
The Simple Mail Transfer Protocol (SMTP) is the main protocol used in electronic mail (e- mail) service.
Encapsulation in the source host, decapsulation in the destination host, and encapsulation and
decapsulation in the router.
2.2.5 Addressing
Any communication that involves two parties needs two addresses: source address and destination
address. Although it looks as if we need five pairs of addresses, one pair per layer, we normally have
only four because the physical layer does not need addresses; the unit of data exchange at the physical
layer is a bit, which definitely cannot have an address.
Figure 2.9 shows the addressing at each layer.
As the figure shows, there is a relationship between the layer, the address used in that layer, and the
packet name at that layer.
At the application layer, we normally use names to define the site that provides services, such as
someorg.com, or the e- mail address, such as somebody@coldmail.com.
At the transport layer, addresses are called port numbers, and these define the application- layer
programs at the source and destination.
Port numbers are local addresses that distinguish between several programs running at the same time.
At the network- layer, the addresses are global, with the whole Internet as the scope.
A network- layer address uniquely defines the connection of a device to the Internet.
The link- layer addresses, sometimes called MAC addresses, are locally defined addresses, each of
which defines a specific host or router in a network (LAN or WAN).
To be able to multiplex and demultiplex, a protocol needs to have a field in its header to identify to
which protocol the encapsulated packets belong.
At the transport layer, either UDP or TCP can accept a message from several application- layer
protocols.
At the network layer, IP can accept a segment from TCP or a user datagram from UDP. IP can also
accept a packet from other protocols such as ICMP, IGMP, and so on.
At the data- link layer, a frame may carry the payload coming from IP or other protocols such as ARP .
First, TCP/IP has more than one transport- layer protocol. Some of the functionalities of the session layer
are available in 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 of the 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.
2.3.2 Lack of OSI Model’s Success
OSI was completed when TCP/IP was fully in place and a lot of time and money had been spent on the
suite; changing it would cost a lot.
Second, some layers in the OSI model were never fully defined. For example, although the services
provided by the presentation and the session layers were listed in the document, actual protocols for
these two layers were not fully defined, nor were they fully described, and the corresponding software
was not fully developed.
Third, when OSI was implemented by an organization in a different application, it did not show a high
enough level of performance to entice the Internet authority to switch from the TCP/IP protocol suite to
the OSI model.
3. Data-Link Layer
3.1 INTRODUCTION
The Internet is a combination of networks glued together by connecting devices (routers or switches).
If a packet is to travel from a host to another host, it needs to pass through these networks.
Figure 3.1 shows the communication at the data- link layer.
Communication at the data- link layer is made up of five separate logical connections between the data-
link layers in the path.
The data-link layer at Alice’s computer communicates with the data- link layer at router R2.
The data-link layer at router R2 communicates with the data- link layer at router R4, and so on.
Finally, the data-link layer at router R7 communicates with the data- link layer at Bob’s computer.
Only one data-link layer is involved at the source or the destination, but two data-link layers are
involved at each router.
The reason is that Alice’s and Bob’s computers are each connected to a single network, but each router
takes input from one network and sends output to another network.
The first node is the source host; the last node is the destination host.
The other four nodes are four routers. The first, the third, and the fifth links represent the three LANs;
The second and the fourth links represent the two WANs.
3.1.2 Services
The data-link layer is located between the physical and the network layers.
The data link layer provides services to the network layer; it receives services from the physical layer.
Let us discuss services provided by the data-link layer.
The duty scope of the data- link layer is node-to-node.
The data- link layer of a node (host or router) is responsible for delivering a datagram to the next node in
the path.
The data- link layer of the source host needs only to encapsulate, the data-link layer of the destination
host needs to decapsulate, but each intermediate node needs to both encapsulate and decapsulate.
Encapsulation and decapsulation are needed because the link- layer addresses are normally different.
Figure 3.3 shows the encapsulation and decapsulation at the data- link layer.
Assumed that we have only one router between the source and destination. The datagram received by
the data- link layer of the source host is encapsulated in a frame.
The frame is logically transported from the source host to the router.
The frame is decapsulated at the data- link layer of the router and encapsulated at another frame.
The new frame is logically transported from the router to the destination host.
Framing
the first service provided by the data- link layer is framing.
The data-link layer at each node needs to encapsulate the datagram (packet received from the network
layer) in a frame before sending it to the next node.
The node also needs to decapsulate the datagram from the frame received on the logical channel.
Flow Control
The sending data- link layer at the end of a link is a producer of frames; the receiving data-link layer at
the other end of a link is a consumer.
If the rate of produced frames is higher than the rate of consumed frames, frames at the receiving end
need to be buffered while waiting to be consumed (processed).
Definitely, we cannot have an unlimited buffer size at the receiving side.
We have two choices. The first choice is to let the receiving data- link layer drop the frames if its buffer
is full.
The second choice is to let the receiving data- link layer send a feedback to the sending data- link layer to
ask it to stop or slow down.
Different data- link-layer protocols use different strategies for flow control.
Error Control
At the sending node, a frame in a data- link layer needs to be changed to bits, transformed to
electromagnetic signals, and transmitted through the transmission media.
At the receiving node, electromagnetic signals are received, transformed to bits, and put together to
create a frame.
Electromagnetic signals are susceptible to error, a frame is susceptible to error.
The error needs first to be detected. After detection, it needs to be either corrected at the receiver node or
discarded and retransmitted by the sending node.
Congestion Control
Most data- link- layer protocols do not directly use a congestion control to alleviate congestion, although
some wide-area networks do.
In general, congestion control is considered an issue in the network layer or the transport layer because
of its end-to-end nature.
Example 3.1
The unicast link-layer addresses in the most common LAN, Ether net, are 48 bits (six bytes) that are
presented as 12 hexadecimal digits separated by colons; for example, the following is a link- layer address of
a computer.
A3:34:45:11:92:F1
Multicast Address
Multicasting means one-to- many communication. However, the jurisdiction is local (inside the link).
Example 9.2
The multicast link- layer addresses in the most common LAN, Ethernet, are 48 bits (six bytes) that are
presented as 12 hexadecimal digits separated by colons. The second digit, however, needs to be an even
number in hexadecimal. The following shows a multicast address:
A2:34:45:11:92:F1
Broadcast Address
Broadcasting means one-to-all communication. A frame with a destination broadcast address is sent to
all entities in the link.
Example 9.3
The broadcast link-layer addresses in the most common LAN, Ethernet, are 48 bits, all 1s, that are
presented as 12 hexadecimal digits separated by colons. The following shows a broadcast address:
FF:FF:FF:FF:FF:FF
9.2.2 Address Resolution Protocol (ARP)
Address Resolution Protocol (ARP) is one of the auxiliary protocols defined in the network layer, as shown
in Figure 3.6.
It belongs to the network layer, it maps an IP address to a logical- link address.
ARP accepts an IP address from the IP protocol, maps the address to the corresponding link-layer
address, and passes it to the data-link layer.
Anytime a host or a router needs to find the link- layer address of another host or router in its network, it
sends an ARP request packet.
The packet includes the link- layer and IP addresses of the sender and the IP address of the receiver.
Because the sender does not know the link-layer address of the receiver, the query is broadcast over the
link using the link- layer broadcast address, which we discuss for each protocol later (see Figure 9.7).
Every host or router on the network receives and processes the ARP request packet, but only the
intended recipient recognizes its IP address and sends back an ARP response packet.
The response packet contains the recipient’s IP and link- layer addresses.
The packet is unicast directly to the node that sent the request packet.
In Figure 3.7a, the system on the left (A) has a packet that needs to be delivered to another system (B)
with IP address N2.
System A needs to pass the packet to its data- link layer for the actual delivery, but it does not know the
physical address of the recipient.
It uses the services of ARP by asking the ARP protocol to send a broadcast ARP request packet to ask
for the physical address of a system with an IP address of N2.
This packet is received by every system on the physical network, but only system B will answer it, as
shown in Figure 9.7b.
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.
4.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.
Framing in the data- link layer separates a message from one source to a destination by adding a sender
address and a destination address.
The destination address defines where the packet is to go; the sender address helps the recipient
acknowledge the receipt.
Frame can be very large, making flow and error control very inefficient. When a message is carried in
one very large frame, even a single-bit error would require the retransmission of the whole frame.
When a message is divided into smaller frames, a single-bit error affects only that small frame.
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. An example of this type of framing is the ATM WAN, which uses frames of fixed
size called cells.
In variable-size framing, we need a way to define the end of one frame and the beginning of the next.
Two approaches were used a) character-oriented approach b) 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.
The flag, composed of protocol-dependent special characters, signals the start or end of a frame.
Figure 4.1 shows the format of a frame in a character-oriented protocol.
Byte stuffing is the process of adding one extra byte whenever there is a flag or escape character in the
text.
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
Byte stuffing by the escape character allows the presence of the flag in the data section of the frame, but
it creates another problem.
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
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.
Most protocols use a special 8-bit pattern flag, 01111110, as the delimiter to define the beginning and
the end of the frame, as shown in Figure 4.3.
Flow Control
Whenever an entity produces items and another entity consumes them, there should be a balance
between production and consumption rates.
If the items are produced faster than they can be consumed, the consumer can be overwhelmed and may
need to discard some items.
If the items are produced more slowly than they can be consumed, the consumer must wait, and the
system becomes less efficient.
Flow control is related to the first issue. We need to prevent losing the data items at the consumer site.
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.
The figure shows that the data- link layer at the sending node tries to push frames toward the data- link
layer at the receiving node.
If the receiving node cannot process and deliver the packet to its network at the same rate that the frames
arrive, it becomes overwhelmed with frames.
Flow control in this case can be feedback from the receiving node to the sending node to stop or slow
down pushing frames.
Buffers
Although flow control can be implemented normally to 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.
Error Control
Error control is implemented 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 both methods, a CRC is added to the frame header by the sender and checked by the
receiver.
❑ 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 (for the purpose of both flow and error control) to the sender.
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
(setup phase).
The logical connection is terminated (teardown phase).
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.
4.2 DATA-LINK LAYER PROTOCOLS
Traditionally four protocols have been defined for the data- link layer to deal with flow and error control:
Simple, Stop-and-Wait, Go-Back-N, and Selective-Repeat.
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.
Figure 4.6, shows an example of a machine using FSM.
There are only three possible events and three possible actions.
The machine starts in state I. If event 1 occurs, the machine performs actions 1 and 2 and moves to state
II. When the machine is in state II, two events may occur.
If event 1 occurs, the machine performs action 3 and remains in the same state, state II.
If event 3 occurs, the machine performs no action, but move to state I.
4.2.1 Simple Protocol
Our first protocol is a simple protocol with neither flow nor error control.
Assume that the receiver can immediately handle any frame it receives.
Figure 4.7 shows the layout for this protocol.
The data-link layer at the sender gets a packet from its network layer, makes a frame out of it, and sends
the frame.
In this protocol, 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.
The silence of the receiver is a signal for the sender that a frame was either corrupted or lost.
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.
This means that the sender needs to keep a copy of the frame until its acknowledgment arrives. When
the corresponding acknowledgment arrives, the sender discards the copy and sends the next frame if it is
ready.
Figure 4.10 shows the outline for the Stop-and-Wait protocol.
Example 11.3
Figure 11.12 shows an example. The first frame is sent and acknowledged. The second frame is sent, but lost.
After time-out, it is resent. The third frame is sent and acknowledged, but the acknowledgment is lost. The
frame is resent. However, there is a problem with this scheme. The network layer at the receiver site receives
two copies of the third packet, which is not right. In the next section, we will see how we can correct this
problem using sequence numbers and acknowledgment numbers.
Example 4.4
Figure 4.13 shows how adding sequence numbers and acknowledgment numbers can prevent duplicates. The
first frame is sent and acknowledged. The second frame is sent, but lost. After time-out, it is resent. The third
frame is sent and acknowledged, but the acknowledgment is lost. The frame is resent.
1) Describe the layer presentation in the TCP/IP model and explain the protocol of each layer.
2) Discuss the TCP/IP model with functionalities of each layer. Consider sources destination and
intermediate nodes for discussion
3) List the different types of addressing in TCP. Explain any one type of addressing with a Suitable
example.
4) Distinguish character stuffing and bit Stuffing with an example.
5) Perform Bit stuffing on the given bit stream
00011111110011100111111100
6) Explain stop and wait protocol .