FRAMING
v FRAMING:
·
In
order to provide services to the network layer, the data link layer must use
the services from the physical layer.
·
The
physical layer sends the bit stream to the data link layer.
·
The
no. of bits received may be different from the no. of bits transmitted.
·
The
data link layer convert the bit stream into data frames and compute the
checksum for each frame.
·
At
the destination, the check sum is recomputed.
·
If
the recomputed check sum is different from the one contained in the frame.
·
An
error has occurred and the data link layer deals with the errors.
·
To
mark the start and end of each frame, we use four methods. They are
1. Character
count.
2. Flag
bytes with byte stuffing.
3. Starting
and ending flags with bit stuffing.
4.
Physical layer coding violations.
1. Character count:
This
method uses a field in the header to specify the number of characters in the
frame.
·
The first framing method uses a
field in the header to specify the number of characters in the 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. This technique is shown in Fig.1(a)
for four frames of sizes 5, 5, 8, and 8 characters, respectively.
1.(a) With out error 1.(b) with error
·
For
example, if the characters count of 5 in the second frame becomes a 7.
·
The
destination will go out of synchronize and will be unable to locate the start
of the next frame.
·
The
destination does not know how many characters to skip over to get to the start
of the re- transmission. For this reason, the character count is rarely used.
2.
Flag bytes with byte stuffing/character stuffing:
·
In
this method, each frame start and end with special bytes. Most protocols have
used the same byte called a flag byte as FLAG at both starting &ending of
the frame.
·
The second framing
method gets around the problem of resynchronization after an error by having
each frame start and end with special bytes. In the past, the starting and ending
bytes were different, but in recent years most protocols have used the same
byte, called a flag byte, as both the starting and ending delimiter, as shown
in 3.2(a) as FLAG.
·
In this way, if the receiver ever loses
synchronization, it can just search for the flag byte to find the end of the current
frame. Two consecutive flag bytes indicate the end of one frame and start of
the next one.
·
Even if the receiver ever loses synchronization,
it can just search for the flag byte to find the end of the current frame.
Fig . (a) A frame delimited by flag bytes. (b) Four
examples ofbyte sequences before and after byte stuffing.
·
The
sender’s data link layer inserts a special escape byte “ESC“just before each
flag byte the data. At the receiving end, the data link layer removes the
escape byte before the data are given to the network layer. This technique is called”
byte stuffing” or “character stuffing”.
·
A
framing flag byte can be identified by the absence or presence of an escape
byte in the data. If an escape byte occurs in the middle of data that, too, is
stuffed with an escape byte.
·
Any
single escape byte is part of an escape sequence, where as a doubled one indicates
that a single escape occurred naturally in the data. Examples of the byte
sequences before & after byte stuffing.
·
A
major disadvantage of this framing method is What happens if
an escape byte occurs in the middle of the original data already. The
transmission takes place by stuffed with an escape byte. Thus, any single
escape byte is part of an escape sequence, whereas a doubled one indicates that
a single escape occurred naturally in the data.
·
It
is used for 8-bit character only. Not all character codes use 8-bit characters,
some use 16-bit characters, so a new technique had to developed to allow sized
characters.
3.
Starting and ending flags, with bit stuffing:
·
In this method, each frame begins and ends
with a special bit pattern, 01111110 a flag byte.
·
When the sender’s data link layer encounters
five consecutive 1’s in the data, it automatically stuffs a 0 bit into outgoing
bit stream.
·
This bit stuffing is similar to byte stuffing.
·
When the receiver sees five
consecutive incoming 1 bits, followed by a 0 bit, it automatically
destuffs (i.e., deletes) the 0 bit. Just as byte stuffing is completely
transparent to the network layer in both computers, so is bit stuffing. If the
user data contain the flag pattern, 01111110, this flag is transmitted as
011111010 but stored in the receiver's memory as 01111110.
·
The boundary between two frames can be recognized
by the flag pattern.
·
If the receiver losses its track the receives has
to scan the input for flag sequences.
·
The flag sequences occur only at frame
boundaries and never with in the data.
4.
Physical layer coding violations:
·
This
framing method is used in the networks in which physical medium contains some redundancy. A 1
bit is a high –low pair & a 0 bit is a low-high pair. It means that every
data bit has a transmission in the middle. It makes easy for the receiver to
locate the bit boundaries.
Comments
Post a Comment