You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
4.8 KiB
HTML
170 lines
4.8 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
<!-- SWP5.html (C) K. J. Turner 18/12/14 -->
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
|
|
|
<title>
|
|
Sliding Window Protocol (5-Column)
|
|
</title>
|
|
|
|
<link rev="made" href="http://www.cs.stir.ac.uk/~kjt/"/>
|
|
|
|
<script type="text/javascript" language="JavaScript">
|
|
|
|
<!--
|
|
var simulator;
|
|
var maxSeq;
|
|
var maxSeqOld = 7;
|
|
var winSize
|
|
var winSizeOld = 3;
|
|
|
|
function validInteger(name, value, min, max) {
|
|
if (!value.match("\\d+") || value < min || value > max) {
|
|
alert("Value for " + name + " must be in range " + min + " to " + max);
|
|
return false;
|
|
}
|
|
else
|
|
return true;
|
|
}
|
|
|
|
function set () {
|
|
maxSeq = document.settings.maxSeq.value;
|
|
winSize = document.settings.winSize.value;
|
|
if (validInteger("Maximum Sequence Number", maxSeq, 1, 31) &&
|
|
validInteger("Window Size", winSize, 1, 31)) {
|
|
maxSeq = parseInt(maxSeq);
|
|
winSize = parseInt(winSize);
|
|
if (winSize <= maxSeq) {
|
|
if (maxSeq != maxSeqOld || winSize != winSizeOld) {
|
|
maxSeqOld = maxSeq;
|
|
winSizeOld = winSize;
|
|
simulator.setParameter("maxSeq", maxSeq);
|
|
simulator.setParameter("winSize", winSize);
|
|
simulator.restart();
|
|
}
|
|
}
|
|
else
|
|
alert("Window Size must be 1 to the Maximum Sequence Number");
|
|
}
|
|
}
|
|
//-->
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body background="simulator.jpeg"
|
|
onload="simulator=document.ProtocolSimulator">
|
|
|
|
<div style="text-align: center">
|
|
|
|
<h1>
|
|
Sliding Window Protocol Simulator
|
|
<br/>
|
|
(5-Column)
|
|
</h1>
|
|
|
|
<img src="simulator.gif" alt="Simulator Logo"/>
|
|
|
|
</div>
|
|
|
|
<p>
|
|
SWP (Sliding Window Protocol) is a connection-less protocol in one
|
|
direction between a pair of users. It allows data to be sent in one
|
|
direction subject to a maximum number of unacknowledged messages. If SWP is
|
|
operated with a window size of 1, it is equivalent to the <a
|
|
href="ABP.html">Alternating Bit Protocol</a>. The simulation below includes
|
|
the users; the <a href="SWP3.html">three-column</a> version omits them.
|
|
</p>
|
|
|
|
<p>
|
|
The protocol has a maximum number of messages that can be sent without
|
|
acknowledgement. If this window becomes full, the protocol is blocked
|
|
until an acknowledgement is received for the earliest outstanding
|
|
message. At this point the transmitter is clear to send more messages.
|
|
</p>
|
|
|
|
<h2>Protocol Parameters</h2>
|
|
|
|
<p>
|
|
The following settings are adequate for a simple simulation. For a more
|
|
advanced exploration, choose different options and click <em>Change
|
|
Settings</em>. This may cause the simulation to restart.
|
|
</p>
|
|
|
|
<form name="settings">
|
|
|
|
<center>
|
|
|
|
<table cellpadding="5">
|
|
|
|
<tr>
|
|
<td align="right">Maximum Sequence Number (1 to 31):</td>
|
|
<td><input type="text" name="maxSeq" value="7" size="2"/></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="right">Window Size (1 to Maximum Sequence Number):</td>
|
|
<td><input type="text" name="winSize" value="3" size="2"/></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="center" colspan="2">
|
|
<input type="button" name="btnSet" value="Change Settings"
|
|
onclick="set()"/>
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</center>
|
|
|
|
</form>
|
|
|
|
<h2>Protocol Simulation</h2>
|
|
|
|
<p>
|
|
The protocol simulation shows a time-sequence diagram with users A and B,
|
|
protocol entities A and B that support them, and a communications medium
|
|
that carries messages. Users request data transmissions with
|
|
<em>DatReq(DATAn),</em> and receive data transmissions as
|
|
<em>DatInd(DATAn)</em>. Data messages are simply numbered <em>DATA0</em>,
|
|
<em>DATA1</em>, etc. without explicit content. The transmitting protocol
|
|
sends the protocol message <em>DT(n)</em> that gives only the sequence
|
|
number, not the data. Once sequence numbers reach a maximum number (like
|
|
7), they wrap back round to 0. An acknowledgement <em>AK(n)</em> means
|
|
that the <em>DT</em> message numbered <em>n</em> is the next one expected
|
|
(i.e. all messages up to but not including this number have been
|
|
received). Since sequence numbers wrap round, an acknowledgement with
|
|
sequence number 1 refers to messages 0, 1, 7, 6, etc. Note that if a
|
|
<em>DT</em> message is received again due to re-transmission, it is
|
|
acknowledged but discarded.
|
|
</p>
|
|
|
|
<center>
|
|
|
|
<applet code="simulator.ProtocolSimulator.class"
|
|
archive="ProtocolSimulator.jar" width="750" height="700"
|
|
name="ProtocolSimulator">
|
|
<param name="protocol" value="SWP5"/>
|
|
</applet>
|
|
|
|
</center>
|
|
|
|
<hr/>
|
|
|
|
<p>
|
|
<a href="index.html"><img src="uparrow.gif" alt="Up Arrow"/></a>
|
|
Up one level to <a href="index.html">Protocol Simulators</a>
|
|
</p>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|