Unit 4 DCN Lecture Notes 46 54
Unit 4 DCN Lecture Notes 46 54
4. Peer–to-Peer Protocols
The network layer is designed to service request from transport layer and issues
service requests to the data link layer. It is responsible for end-to-end(source to
destination) packet delivery, whereas the data link layer is responsible for node-to-
node(hope-to-hope) packet delivery.
Path Determination. The network layer must determine the route or path taken by
packets as they flow from a sender to a receiver. The algorithms that calculate these
paths are referred to as routing algorithms.
Switching. When a packet arrives at the input to a router, the router must move it to
the appropriate output link. For example, a packet arriving from host H1 to router R2
must either be forwarded towards H2 either along the link from R2 to R1.
Call Setup. Some network architectures require router call setup along the path
before the data flows.
Each packet is forwarded based on the label in the packet. To follow the idea of
connection-oriented design to be used in the Internet. In this case, the forwarding
decision is based on the value of the label, or virtual circuit identifier as it is
sometimes called.
In the setup phase, the source and destination addresses of the sender and
receiver is used to make table entries for the connection-oriented service.
In the teardown phase, the source and destination inform the router to delete
the corresponding entries.
Data transfer occurs between Source and destination.
When the Internet started, the network layer was designed to provide a
connectionless service, in which the network layer protocol treats each packet
independently, with each packet having no relationship to any other packet. The
packets in a message may or may not travel the same path to their destination.
The network layer is only responsible for delivery of packets from the source to the
destination. As shown in below fig.
When the network layer provides a connectionless service, each packet traveling in
the Internet is an independent entity; there is no relationship between packets
belonging to the same message. The switches in this type of network are called
routers. A packet belonging to a message may be followed by a packet belonging
to the same message or a different message. A packet may be followed by a
packet coming from the same or from a different source.
Each packet is routed based on the information contained in its header: source and
destination address. The destination address defines where it should go; the source
address defines where it comes from. The router in this case routes the packet
based only on the destination address. The source address may be used to send an
error message to the source if the packet is discarded. Connectionless Transfer
Services will do
Services Models
There are two broad categories of service models
Connection Oriented Service
Connectionless Service
The service provided by a given layer can have the following features
Sequence
Reliability
Timing
Multiplexing
Flow Control
Message Size
Privacy, Integrity & Authentication
Pacing
Single Hop
Peer-to-peer protocol that operates across a single hop in a network uses the physical
and datalink layer of the OSI reference model to show how datalink layer provides service
for the transfer of packets across a single link in the network. The datalink layer takes
packets from the network layer, encapsulates them in frames and it transfers across the
link and delivers them to the network layer at the other end.
End-to-End
In end to end the transport layer accept messages from the higher layer and transfer
these message by exchanging segments, end to end cross the network exchange of
segment is accomplished by using network layer service.
ARQ PROTOCOLS
Automatic Repeat reQuest (ARQ), also known as Automatic Repeat Query, is
an error-control method for data transmission that uses acknowledgements
(messages sent by the receiver indicating that it has correctly received a data frame
or packet) and timeouts (specified periods of time allowed to elapse before an
acknowledgment is to be received) to achieve reliable data transmission over an
unreliable service. If the sender does not receive an acknowledgment before the
timeout, it usually re-transmits the frame/packet until the sender receives an
acknowledgment or exceeds a predefined number of re-transmissions.
Data are sent as a sequence of frames; frames arrive in the same order in which
they are sent; and each transmitted frame suffers an arbitrary and potentially
variable amount of delay before reception. In addition,
• Lost frame: A frame fails to arrive at the other side. For example, a noise burst
may damage a frame to the extent that the receiver is not aware that a frame has
been transmitted.
• Damaged frame: A recognizable frame does arrive, but some of the bits are
in error (have been altered during transmission).
The most common techniques for error control are based on some or all of the
following ingredients:
• Error detection: A there will be errors, resulting in the change of one or more bits
in a transmitted frame.
• Retransmission after timeout: The source retransmits a frame that has not
been acknowledged after a predetermined amount of time.
Collectively, these mechanisms are all referred Collectively, these mechanisms are
all referred to as automatic repeat request (ARQ); the effect of ARQ is to turn an
unreliable data link into a reliable one.
Stop-and-wait ARQ
Go-Back-N ARQ
All three protocols usually use some form of sliding window protocol to tell the
transmitter determine which (if any) packets need to be retransmitted.
These protocols reside in the Data Link or Transport Layers of the OSI model.
Stop-and-Wait ARQ
Also called Stop-and-Wait Automatic Repeat reQuest (ARQ)
It is the simplest form.
Source may not send new frame until receiver acknowledges the frame
already sent.
Very inefficient, especially when a single message is broken into
separate frames, or when the data link is long enough for significant
delays to be introduced.
A source entity transmits a frame. After the destination entity receives the frame, it
indicates its willingness to accept another frame by sending back an acknowledgment
to the frame just received. The source must wait until it receives the
acknowledgment before sending the next frame. The destination can thus stop the
flow of data simply by withholding acknowledgment.
When a message is sent in a few large frames. However, it is often the case that a
source will break up a large block of data into smaller blocks and transmit the data
in many frames. This is done for the following reasons:
• The longer the transmission, the more likely that there will be an error,
necessitating retransmission of the entire frame. With smaller frames, errors are
detected sooner, and a smaller amount of data needs to be retransmitted.
The sender sends one frame and waits for feedback from the receiver. When the ACK
arrives, the sender sends the next frame. Note that sending two frames in the
protocol involves the sender in four events and the receiver in two events.
Go-Back-N- ARQ
Go-Back-N ARQ is a specific instance of the automatic repeat request (ARQ) protocol, in
which the sending process continues to send a number of frames specified by
a window size even without receiving an acknowledgement (ACK) packet from the
receiver. It is a special case of the general sliding window protocol with the transmit
window size of N and receive window size of 1.
The receiver process keeps track of the sequence number of the next frame it expects
to receive, and sends that number with every ACK it sends. The receiver will ignore
any frame that does not have the exact sequence number it expects – whether that
frame is a "past" duplicate of a frame it has already ACK'ed or whether that frame is a
"future" frame past the last packet it is waiting for. Once the sender has sent all of
the frames in its window, it will detect that all of the frames since the first lost frame
are outstanding, and will go back to sequence number of the last ACK it received
from the receiver process and fill its window starting with that frame and continue the
process over again.
Go-Back-N ARQ is a more efficient use of a connection than Stop-and-wait ARQ, since
unlike waiting for an acknowledgement for each packet, the connection is still being
utilized as packets are being sent. In other words, during the time that would
otherwise be spent waiting, more packets are being sent. However, this method
also results in sending frames multiple times – if any frame was lost or damaged, or
the ACK acknowledging them was lost or damaged, then that frame and all
following frames in the window (even if they were received without error) will be re-
sent. To avoid this, Selective Repeat ARQ can be used.
Frame transmissions are pipelined to keep the channel busy. Frame with errors and
subsequent out-of-sequence frames are ignored. Transmitter is forced to go back
when window of 4 is exhausted.
When the protocol delivery messages, the sending process continues to send a
number of frames specified by a window size even after a frame loss. The receiving
process will continue to accept and acknowledge frames sent after an initial error.
The receiver process keeps track of the sequence number of the earliest frame
it has not received, and sends that number with every ACK it sends. If a frame from
the sender does not reach the receiver, the sender continues to send subsequent
frames until it has emptied its window.
The receiver continues to fill its receiving window with the subsequent frames,
replying each time with an ACK containing the sequence number of the earliest
missing frame. Once the sender has sent all the frames in its window, it re-sends the
frame number given by the ACKs, and then continues where it left off.
The size of the sending and receiving windows must be equal, and half the
maximum sequence number (assuming that sequence numbers are numbered from 0
to n-1) to avoid miscommunication in all cases of packets being dropped. To
understand this, consider the case when all ACKs are destroyed.
If the receiving window is larger than half the maximum sequence number,
some, possibly even all, of the packages that are resent after timeouts are duplicates
that are not recognized as such. The sender moves its window for every packet that is
acknowledged.
PIGGYBACKING
Whenever TCP is about to ACK the data it has received from the client, it does not
immediately, rather it delays the ACK and see whether any data has to be sent to the
client, so the ACK can be sent along with the data. This is called Piggyback. Or The
process of sending data along with the acknowledgment is called piggybacking.
Sliding-window flow control is best utilized when the buffer size is limited and pre-
established. During a typical communication between a sender and a receiver the
receiver allocates buffer space for n frames (n is the buffer size in frames). The
sender can send and the receiver can accept n frames without having to wait for an
acknowledgement. A sequence number is assigned to frames in order to help keep
track of those frames which did receive an acknowledgement. The receiver
acknowledges a frame by sending an acknowledgement that includes the sequence
number of the next frame expected. This acknowledgement announces that the
receiver is ready to receive n frames, beginning with the number specified. Both the
sender and receiver maintain what is called a window. The size of the window is less
than or equal to the buffer size.
Sliding window flow control has a far better performance than stop-and-wait flow
control. This is because in a wireless environment data rates are very low and noise
level is very high, so waiting for an acknowledgement for every packet that is
transferred is not very feasible. Therefore, transferring data as a bulk would yield a
better performance in terms of higher throughput.
Sliding window flow control is a point to point protocol assuming that no other entity
tries to communicate until the current data transfer is complete. The window
maintained by the sender indicates which frames he can send. The sender sends all
the frames in the window and waits for an acknowledgement (as opposed to
acknowledging after every frame). The sender then shifts the window to the
corresponding sequence number, thus indicating that frames within the window
starting from the current sequence number can be sent.
Frames are the small data units created by data link layer and the process of creating
frames by the data link layer is known as framing.
a) Character count.
b) Starting and Ending character with character stuffing.
c) Starting and Ending flags with bit stuffing.
a) Character Count.
This method specifies the number of character present in a particular frame. This
information is specified by using a specified field in the header frame. When the
data link layer at the destination sees the character count, it knows how many
characters follow and hence where the end of the frame is.
Fig (a). Char count includes the counting character itself:
The trouble with this algorithm is that the count can be garbled by a transmission
error. For example, if the character count of 5 in the second frame of Fig (b) becomes
a 7, the destination will get out of synchronization and will be unable to locate the start
of the next frame. Even if the checksum is incorrect so the destination knows that the
frame is bad, it still has no way of telling where the next frame starts. Sending a frame
back to the source asking for a retransmission does not help either, since the
destination does not know how many characters to skip over to get to the start of the
retransmission. For this reason, the character count method is rarely used anymore.
In this method frame starts and end with a special character that mark the beginning
and end of frame.
Each character begins with the ASCII character sequence DLE STX (data link
Escape Start Of Text ) and end with ASCII character sequence DLE ETX (data link
escape End Of text).
In this Method, Each Begins & Ends with a Special Bit pattern 01111110 Called Flags.
There for each frame starts with 01111110 and also ends with 01111110.
The main problem arises in this method when the Flag byte 01111110 Appear as data.
This problem is handled by technique called Bit stuffing. ie, Sender always insert a
0 after five 1’s, Receiver always removes a 0 after five 1’s.
(a) Original data. (b) Stuffed data transmitted. (c) De-stuffed data received.
1. A framing method that unambiguously delineates the end of one frame and the
start of the next one. The frame format also handles error detection.
2. A link control protocol for bringing lines up, testing them, negotiating options, and
bringing them down again gracefully when they are no longer needed. This protocol is
called LCP (Link Control Protocol). It supports synchronous and asynchronous circuits
and byte-oriented and bit-oriented encodings.
3. A way to negotiate network-layer options in a way that is independent of the
network layer protocol to be used. The method chosen is to have a different NCP
(Network Control Protocol) for each network layer supported.
Flag. It indicates the start and end of a PPP frame always has the value “01111110”.
Address. In High-Level Data Link Control this is the address of the destination of the
frame. But in Point-to-Point Protocol we are dealing with a direct link between two devices,
so this field has no real meaning. It is thus always set to “11111111”, which is equivalent
to a broadcast (it means “all stations”).
Control. This field is set to the constant value 11000000. PPP does not provide any
flow control. Error control is also limited to error detection. This means that this field is
not needed at all, and again, the two parties can agree, during negotiation, to omit
this 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. The data field is byte stuffed if the flag byte pattern
appears in this field. Because there is no field defining the size of the data field,
padding is needed if the size is less than the maximum default value or the maximum
negotiated value.
FCS. The frame check sequence (FCS) is simply a 2-byte or 4-byte standard CRC.
Flag Fields Flag fields delimit the frame at both ends with the unique pattern
01111110. A single flag may be used as the closing flag for one frame and the opening
flag for the next. there is no assurance that the pattern 01111110 will not appear
somewhere inside the frame, thus destroying synchronization. To avoid this problem, a
procedure known as bit stuffing is used. For all bits between the starting and ending
flags, the transmitter inserts an extra 0 bit after each occurrence of five 1s in the
frame. After detecting a starting flag, the receiver monitors the bit stream.
Address Field The address field identifies the secondary station that transmitted or
is to receive the frame. The address field is usually 8 bits long but, by prior
agreement, an extended format may be used in which the actual address length is a
multiple of 7 bits. The leftmost bit of each octet is 1 or 0 according as it is or is not
the last octet of the address field. The remaining 7 bits of each octet form part of the
address. The single-octet address of 11111111 is interpreted as the all-stations
address in both basic and extended formats. It is used to allow the primary to
broadcast a frame for reception by all secondaries.
Control Field HDLC defines three types of frames, each with a different control field
format. Information frames (I-frames) carry the data to be transmitted for the user.
Supervisory frames (S-frames) provide the ARQ mechanism when piggybacking is
not used. Unnumbered frames (U-frames) provide supplemental link control
functions. The first one or two bits of the control field serves to identify the frame type.
The remaining bit positions are organized into subfields.
Information Field The information field is present only in I-frames and some U-
frames. The field can contain any sequence of bits but must consist of an integral
number of octets. The length of the information field is variable up to some
system defined maximum.
Frame Check Sequence Field The frame check sequence (FCS) is an error detecting
code calculated from the remaining bits of the frame, exclusive of flags. The normal
code is the 16-bit CRC-CCITT. An optional 32-bit FCS, using CRC-32, may be employed
if the frame length or the line reliability.
dictates this choice.
To accomplish these goals, the data link layer takes the packets it gets from the
network layer and encapsulates them into frames for transmission. Each frame
contains a frame header, a payload field for holding the packet, and a frame trailer,
as shown in below fig.