Вы находитесь на странице: 1из 7

John Bellizzi

Computer Networks
Lab 2
March 22, 2015
Program Output (comments on the output will be written in blue):
PROGRAM INITIALIZED.
*-------------------------------------------------------------------*
Layer 4 Sending.
Reading File...
File read. File size: 829 characters

Layer 4 reads in the txt file and


also returns the file size.

File content:
THE TIGER by William Blake (17571827).
TIGER, tiger, burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?
In what distant deeps or skies
Burnt the fire of thine eyes?
On what wings dare he aspire?
What the hand dare seize the fire?
And what shoulder and what art
Could twist the sinews of thy heart?
And when thy heart began to beat,
What dread hand and what dread feet?

The special control characters can


be seen in the data. My command
prompt printed STX as a smiley
face, ETX as a heart, and DLE as a
sideways triangle.

What the hammer? what the chain?


In what furnace was thy brain?
What the anvil? What dread grasp
Dare its deadly terrors clasp?
When the stars threw down their spears,
And water'd heaven with their tears,
Did He smile His work to see?
Did He who made the lamb make thee?
Tiger, tiger, burning bright
In the forests of the night,
What immortal hand or eye
Dare frame thy fearful symmetry?

Sending down to Layer 3.


*-------------------------------------------------------------------*
Layer 3

Data split into 14 segment(s).


Packet contents:
0000000000000000000000000000000000000000THE TIGER by William Blake (17571827
).
TIGER, tiger, bu
0000000000000000000000000000000000000000rning bright
In the forests of the night,
What immortal hand
0000000000000000000000000000000000000000 or eye
Could frame thy fearful symmetry?
In what distant
0000000000000000000000000000000000000000deeps or skies
Burnt the fire of thine eyes?
On what win
0000000000000000000000000000000000000000gs dare he aspire?
What the hand dare seize the fire?
And w
0000000000000000000000000000000000000000hat shoulder and what art
Could twist the sinews of thy hear
0000000000000000000000000000000000000000t?
And when thy heart began to beat,
What dread hand and wha
0000000000000000000000000000000000000000t dread feet?
What the hammer? what the chain?
In what furn
0000000000000000000000000000000000000000ace was thy brain?
What the anvil? What dread grasp
Dare its
0000000000000000000000000000000000000000 deadly terrors clasp?
When the stars threw down their spea
0000000000000000000000000000000000000000rs,
And water'd heaven with their tears,
Did He smile His
0000000000000000000000000000000000000000work to see?
Did He who made the lamb make thee?
Tiger, tig
0000000000000000000000000000000000000000er, burning bright
In the forests of the night,
What immort
0000000000000000000000000000000000000000al hand or eye
Dare frame thy fearful symmetry?

*-------------------------------------------------------------------*
Layer 2
Data split into 14 frame(s)

Layer 3 receives the file data and


splits it into segments so that each
segment only has 60 characters in
its data field. It also adds on a 40
character long header to each
segment

stuff_chars = 7
bufferSize: 1676
frames 14
120000000000000000000000000000000000000000000000000000THE TIGER by William Bla
ke (17571827).
Layer 2 receives the
TIGER, tiger, buE9CC
segments from layer 3
(including layer 3s
120010000000000000000000000000000000000000000000000000rning bright
headers) and adds onto
In the forests of the night,
this its own headers and
What immortal handE338
trailers. Layer 2 then
sums the char values
120020000000000000000000000000000000000000000000000000 or eye
contained in the frames
Could frame thy fearful symmetry?
Count, ACK, Seq#,
LFrame, and layer3
In what distant E427
header/data fields and
stores this value as a 4
120030000000000000000000000000000000000000000000000000deeps or skies
digit hex number in the
Burnt the fire of thine eyes?
Checksum field.
On what winE4F2
Within the data field,
120040000000000000000000000000000000000000000000000000gs dare he aspire?
layer 2 then adds stuffed
What the hand dare seize the fire?
characters (DLEs which
are represented by
And wE396
sideways triangles) before
each special control
120050000000000000000000000000000000000000000000000000hat shoulder and what art
character.
Could twist the sinews of thy hearE2FC
120060000000000000000000000000000000000000000000000000t?
And when thy heart began to beat,
What dread hand and whaE40B
120070000000000000000000000000000000000000000000000000t dread feet?
What the hammer? what the chain?
In what furnE46E
120080000000000000000000000000000000000000000000000000ace was thy brain?
What the anvil? What dread grasp
Dare itsE3CE
120090000000000000000000000000000000000000000000000000 deadly terrors clasp?
When the stars threw down their speaE32C
1200:0000000000000000000000000000000000000000000000000rs,
And water'd heaven with their tears,
Did He smile His E4C2
1200;0000000000000000000000000000000000000000000000000work to see?
Did He who made the lamb make thee?
Tiger, tigE4B2

In the data represented


on the left, the checksum
value of each frame is
highlighted in yellow, and
each stuffed control
character is highlighted in
green. Each frame also
starts with an STX
character (smiley face)
and ends with an ETX
character (heart)

1200<0000000000000000000000000000000000000000000000000er, burning bright


In the forests of the night,
What immortE3E2
1090=1000000000000000000000000000000000000000000000000al hand or eye
Dare frame thy fearful symmetry?
E394
*-------------------------------------------------------------------*
Layer 1
Transmitting layer 1 data to receiver
.
.
.
.
.
.
.
.
.
.
.
.
*-------------------------------------------------------------------*
*-------------------------------------------------------------------*
Receiver

The frames from layer 2 are then


passed down to layer 1, which just
returns the pointer to the frames
back to the transmit function, which
in turn sends this data pointer to the
receive function. Receive then calls
layer 1, which pass the pointer to the
data to layer 2

*-------------------------------------------------------------------*
Layer 1
Sending layer 1 data up to layer 2
*-------------------------------------------------------------------*
Layer 2
Data split into 14 frame(s)
stuff_chars = 0
bufferSize: 1669

On the receiving end, layer 2 gets the


data pointer from layer 1 and performs
its own checksum of the character data
within the fields that were previously
summed in transmission, and compares
this value to the checksum value in the
Checksum field that it has received. If
these values are not equal, then an
error in transmission has occurred;
otherwise, the program continues
normally.

frames 14
120000000000000000000000000000000000000000000000000000THE TIGER by William Bla
ke (17571827).
TIGER, tiger, buE9CC
120010000000000000000000000000000000000000000000000000rning bright
In the forests of the night,
What immortal handE338
120020000000000000000000000000000000000000000000000000 or eye

Could frame thy fearful symmetry?


In what distant E427
120030000000000000000000000000000000000000000000000000deeps or skies
Burnt the fire of thine eyes?
On what winE4F2
120040000000000000000000000000000000000000000000000000gs dare he aspire?
What the hand dare seize the fire?
And wE396
120050000000000000000000000000000000000000000000000000hat shoulder and what art
Could twist the sinews of thy hearE2FC
120060000000000000000000000000000000000000000000000000t?
And when thy heart began to beat,
What dread hand and whaE40B
120070000000000000000000000000000000000000000000000000t dread feet?
What the hammer? what the chain?
In what furnE46E

The additional step that


layer 2 takes is to de-stuff
the DLE characters from
the data field it has
received. As can be seen in
the data stream on the left,
the control characters
within the data no longer
have an extra preceding
DLE character.

120080000000000000000000000000000000000000000000000000ace was thy brain?


What the anvil? What dread grasp
Dare itsE3CE
120090000000000000000000000000000000000000000000000000 deadly terrors clasp?
When the stars threw down their speaE32C
1200:0000000000000000000000000000000000000000000000000rs,
And water'd heaven with their tears,
Did He smile His E4C2
1200;0000000000000000000000000000000000000000000000000work to see?
Did He who made the lamb make thee?
Tiger, tigE4B2
1200<0000000000000000000000000000000000000000000000000er, burning bright
In the forests of the night,
What immortE3E2
1090=1000000000000000000000000000000000000000000000000al hand or eye
Dare frame thy fearful symmetry?
E394
Sending layer 2 data up to layer 3
*-------------------------------------------------------------------*

Layer 3
Data split into 14 segment(s).
Packet contents:
THE TIGER by William Blake (17571827).
TIGER, tiger, burning bright
In the forests of the night
,
What immortal hand or eye
Could frame thy fearful symmetry?
In what distant deeps or skies
Burnt
the fire of thine eyes?
On what wings dare he aspire?
What the hand dare seize the fire?
And w
hat shoulder and what art
Could twist the sinews of thy heart?
And when thy heart began to beat,
Wha
t dread hand and what dread feet?
What the hammer? what the chain?
In what furnace was thy brain?
W
hat the anvil? What dread grasp
Dare its deadly terrors clasp?
When the stars threw down their spea
rs,
And water'd heaven with their tears,
Did He smile His work to see?
Did He who made the lamb ma
ke thee?
Tiger, tiger, burning bright
In the forests of the night,
What immortal hand or eye
Dare
frame thy fearful symmetry?

Writing file...
THE TIGER by William Blake (17571827).
TIGER, tiger, burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?

Layer 3 receives the data from layer 2 and


keeps only the pertinent layer 3 header and
data fields. Layer 3 then calls a write
function to write the data it has received (not
including the layer 3 header field) to a
separate received file.

In what distant deeps or skies


Burnt the fire of thine eyes?
On what wings dare he aspire?
What the hand dare seize the fire?
And what shoulder and what art
Could twist the sinews of thy heart?
And when thy heart began to beat,
What dread hand and what dread feet?
What the hammer? what the chain?
In what furnace was thy brain?
What the anvil? What dread grasp
Dare its deadly terrors clasp?
When the stars threw down their spears,
And water'd heaven with their tears,
Did He smile His work to see?
Did He who made the lamb make thee?
Tiger, tiger, burning bright
In the forests of the night,
What immortal hand or eye
Dare frame thy fearful symmetry?

File written to output file


Sending layer 3 data up to layer 4
*-------------------------------------------------------------------*
Layer 4 Received File.
PROGRAM FINISHED.

Вам также может понравиться