📄 dlpjava tutorial.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0049)http://www.macs.hw.ac.uk/~pjbk/nets/tutorial.html -->
<!--Converted with jLaTeX2HTML 2002-2-1 (1.70) JA patch-2.0patched version by: Kenshi Muto, Debian Project.* modified by: Shige TAKENOLaTeX2HTML 2002-2-1 (1.70),original version by: Nikos Drakos, CBLU, University of Leeds* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>dlpjava Tutorial</TITLE>
<META content="dlpjava Tutorial" name=description>
<META content=tutorial name=keywords>
<META content=document name=resource-type>
<META content=global name=distribution>
<META http-equiv=Content-Type content="text/html; charset=EUC-JP">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<META http-equiv=Content-Style-Type content=text/css><LINK href="tutorial.css"
rel=STYLESHEET><LINK href="node1.html" rel=next></HEAD>
<BODY>
<H1 align=center>dlpjava Tutorial</H1>
<DIV>
<P align=center><STRONG>Peter King</STRONG></P></DIV>This tutorial aims to make
you familiar with the workings of the <CODE>dlpjava</CODE> simulator.
<P>
<OL>
<LI>Copy the files <CODE>Stopwait.java</CODE> and <CODE>GoBackN.java</CODE>
from the directory <CODE>/u1/cs3/public/F23ND2</CODE> to your current
directory.
<LI>Copy <CODE>Stopwait.java</CODE> to <CODE>Stopwait1.java</CODE>, and edit
<CODE>Stopwait1.java</CODE> so that the class identifier and its corresponding
constructor are now <CODE>Stopwait1</CODE> (if you don't do this it won't
compile!).
<LI>Comment out the call to <CODE>super( windowsize, timer);</CODE> on line
14, and try to run the simulator <PRE>~pjbk/dlpjava Stopwait1.java
</PRE>This will show what happens if you do not call the constructor of the
<CODE>Protocol</CODE> base class from your derived class.
<P></P>
<LI>Uncomment the call on <CODE>super(..)</CODE> and then change the type of
the parameter of <CODE>FrameArrival</CODE> from <CODE>Object</CODE> to
<CODE>DLL_Frame</CODE>. Rerun the simulator. This shows what happens if the
methods you must write do not match their signatures <I>exactly</I>.
<P></P>
<LI>Return the type of the parameter of <CODE>FrameArrival</CODE> to
<CODE>Object</CODE> and re compile the protocol. It will compile successfully
and start running.
<P>Click the <I>Display Parameters</I> button. A window will appear showing
the value of all the parameters. This can be discarded with the <I>OK</I>
button. Click the <I>Initialise</I> button. Two more windows will be created.
<P><I>Events</I> lists the events that are going to occur in the future. The
first item on the list is the event that will occur when the <I>Step</I>
button is pressed. In this case it is <I>PacketArrival</I> at time 0.0 at
protocol <I>A</I>. It is immediately followed by a similar event at
protocol <I>B</I>.
<P><I>Visualisation</I> displays an animation of what is going on in the
protocols and in the channel. The top of the window shows the traffic flowing
from <I>A</I> to <I>B</I>, the bottom shows it flowing from <I>B</I>
to <I>A. </I>Click on the <I>Step</I> button. The first event disappears
from the events list window. A series of messages appear in the main window
under <I>A</I>. These identify the packet that has just arrived, its
length etc, and indicate what operations the protocol has initiated on the
channel (<I>Sending frame...</I>) and on timers (<I>Timer 0: Started...</I>).
Two more events have been scheduled for protocol <I>A</I>: a
<I>TimeOut</I> at 250 and a <I>ChannelIdle</I> at 433.33. In the
<I>Visualisation</I> window, <I>A1</I> appears at the top of the list on the
left -- this is packets which have been accepted by <I>A</I> but not yet
delivered to the network layer at <I>B</I>. The green oval on the left
also changes to a red rectangle, indicating that the network layer at that
protocol has been disabled and will not attempt to send any more packets.
<P>Clicking <I>Step</I> again causes the <I>PacketArrival</I>
at <I>B</I>. A similar series of messages and new events are added to
appropriate windows.
<P>Clicking <I>Step</I> again causes the <I>TimeOut</I> at <I>A</I>.
Before it occurs, the frame being transmitted can be seen starting its way
across the channel. Its blue colour indicates that it has not suffered a
transmission error. Clicking on the channel area will bring up a display of
the frame and its contents. This can be dismissed by clicking <I>OK</I>.
<P>Clicking <I>Step</I> <I>twice</I> more will cause the <I>ChannelIdle</I>
event at <I>A</I>. Notice that because the timer had already expired, a
new frame is transmitted immediately. After clicking <I>Step</I> twice more
(once for the <I>TimeOut</I> at <I>B</I> and once for the
<I>FrameArrival</I> at <I>B</I>) a frame boundary will cross the channel.
In this case, both frames have identical contents, and identical
acknowledgements, because no new information has reached the other end. The
<I>A1</I> disappears from the list at the left of the <I>Visualisation</I>
window because it has now been delivered (even though protocol <I>A</I>
will not discover this until the arrival of the next but one frame, because
the one currently being transmitted obviously reflects the situation at the
time it <I>started</I> transmission).
<P>After another couple of clicks on <I>Step</I>, another set of
<I>TimeOut</I> and <I>ChannelIdle</I> events occur. The frame sent
from <I>B</I> to <I>A</I> is green, though, reflecting that it has
encountered a transmission error. When it finally arrives at <I>A</I>,
a <I>CheckSumError</I> event occurs.
<P>Continue clicking on <I>Step</I> (or click <I>Run</I> once) to see how
the simulation proceeds.
<P>When the simulation stops (if <I>Run</I> was used) or when the time exceeds
2500, you can click on <I>Display Results</I>.
<P></P>
<LI>The default parameter settings make some effects difficult to observe. Use
the <I>Channel</I> menu to set the channel capacity to 1550000 (approximately
1.5Mbps). You will need to click <I>Initialise</I> again for this to take
effect, but you can then run another simulation.
<P></P>
<LI>If you wish extra information about what is happening inside the protocol,
edit the code, and insert calls on the <CODE>trace()</CODE> method where you
wish information. <CODE>trace</CODE> takes a single <CODE>String</CODE>
parameter that is printed in the appropriate output window and in the trace
file.
<P></P>
<LI><I>CheckSumError</I> events can be caused with the mouse. <I>Right
click</I> on a frame in the visualisation window and it will turn green -- and
cause a <I>CheckSumError</I> when it arrives. Likewise, clicking with the
centre button causes a frame to be completely lost.
<P>Experiment with deleting frames and causing transmission errors to see if
you can cause the protocol to deliver any packets in the wrong order. </P>
<LI>Modify the code of <CODE>Stopwait1</CODE> so that no check is made on the
sequence number before a packet is delivered to the network layer. To do this
modify line 26 from <PRE> if (f.sequence == frameExpected)
</PRE>to <PRE> if (true)
</PRE>
<P>The simulator will report an error when the second copy of the packet is
delivered, since there are no undelivered packets.
<P></P>
<LI>Now use the <CODE>GoBackN</CODE> protocol. Run it, and modify the channel
capacity to 1550000. Setting the window size can be done from the
<I>Protocol</I> menu. Experiment with different sizes to evaluate the
``best''.
<P></P>
<LI>Change the mean packet length at one of the protocols (<I>not</I> both).
Try running the simulation at several different window sizes to see what size
is ``best'' now. </LI></OL><BR>
<HR>
<ADDRESS>Peter JB King </ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -