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.
281 lines
8.7 KiB
HTML
281 lines
8.7 KiB
HTML
4 years ago
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
|
||
|
<!-- TCPcs.html (C) K. J. Turner 18/12/14 -->
|
||
|
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
|
|
||
|
<head>
|
||
|
|
||
|
<title>Transmission Control Protocol (Client-Server)</title>
|
||
|
|
||
|
<link rev="made" href="http://www.cs.stir.ac.uk/~kjt/"/>
|
||
|
|
||
|
<script type="text/javascript" language="JavaScript">
|
||
|
|
||
|
<!--
|
||
|
|
||
|
var simulator;
|
||
|
var userAMessageSize;
|
||
|
var userAMessageSizeOld = 100;
|
||
|
var userBMessageSize;
|
||
|
var userBMessageSizeOld = 300;
|
||
|
var windowSizeA;
|
||
|
var windowSizeAOld = 500;
|
||
|
var windowSizeB;
|
||
|
var windowSizeBOld = 400;
|
||
|
var maxSendPacket;
|
||
|
var maxSendPacketOld = 200;
|
||
|
|
||
|
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 validFloat(name, value, min, max) {
|
||
|
if (!value.match("\\d+\.\\d+") || value < min || value > max) {
|
||
|
alert("Value for " + name + " must be in range " + min + " to " + max);
|
||
|
return false;
|
||
|
}
|
||
|
else
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
function set() {
|
||
|
userAMessageSize = document.settings.userAMessageSize.value;
|
||
|
userBMessageSize = document.settings.userBMessageSize.value;
|
||
|
windowSizeA = document.settings.windowSizeA.value;
|
||
|
windowSizeB = document.settings.windowSizeB.value;
|
||
|
maxSendPacket = document.settings.maxSendPacket.value;
|
||
|
lossRate = document.settings.lossRate.value;
|
||
|
if (validInteger("User A Message Size", userAMessageSize, 10, 1000) &&
|
||
|
validInteger("User B Message Size", userBMessageSize, 10, 1000) &&
|
||
|
validInteger("Protocol A Receive Window", windowSizeA, 10, 1000) &&
|
||
|
validInteger("Protocol B Receive Window", windowSizeB, 10, 1000) &&
|
||
|
validInteger("Medium Maximum Packet Size", maxSendPacket, 10, 1000) &&
|
||
|
validFloat("Loss Rate", lossRate, 0.0, 1.0)) {
|
||
|
if (userAMessageSize != userAMessageSizeOld ||
|
||
|
userBMessageSize != userBMessageSizeOld ||
|
||
|
windowSizeA != windowSizeAOld ||
|
||
|
windowSizeB != windowSizeBOld ||
|
||
|
maxSendPacket != maxSendPacketOld)
|
||
|
simulator.restart();
|
||
|
userAMessageSizeOld = userAMessageSize;
|
||
|
userBMessageSizeOld = userBMessageSize;
|
||
|
windowSizeAOld = windowSizeA;
|
||
|
windowSizeBOld = windowSizeB;
|
||
|
maxSendPacketOld = maxSendPacket;
|
||
|
simulator.setParameter("userAMessageSize", userAMessageSize);
|
||
|
simulator.setParameter("userBMessageSize", userBMessageSize);
|
||
|
simulator.setParameter("windowSizeA", windowSizeA);
|
||
|
simulator.setParameter("windowSizeB", windowSizeB);
|
||
|
simulator.setParameter("maxSendPacket", maxSendPacket);
|
||
|
simulator.setParameter("lossRate", lossRate);
|
||
|
if (document.settings.pushA.checked)
|
||
|
simulator.setParameter("pushA", "true");
|
||
|
else
|
||
|
simulator.setParameter("pushA", "false");
|
||
|
if (document.settings.pushB.checked)
|
||
|
simulator.setParameter("pushB", "true");
|
||
|
else
|
||
|
simulator.setParameter("pushB", "false");
|
||
|
simulator.updateActionList();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//-->
|
||
|
|
||
|
</script>
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body background="simulator.jpeg"
|
||
|
onload="simulator=document.ProtocolSimulator">
|
||
|
|
||
|
<div style="text-align: center">
|
||
|
|
||
|
<h1>
|
||
|
Transmission Control Protocol Simulator
|
||
|
<br/>
|
||
|
(Client-Server)
|
||
|
</h1>
|
||
|
|
||
|
<img src="simulator.gif" alt="Simulator Logo"/>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<h2>Protocol Description</h2>
|
||
|
|
||
|
<p>
|
||
|
TCP (Transmission Control Protocol) is a connection-oriented protocol for
|
||
|
transferring data reliably in either direction between a pair of users. TCP
|
||
|
is a rather complex protocol, so it is easy to lose track of the simulation.
|
||
|
Try not to do anything too complicated! There is a <a
|
||
|
href="TCPpp.html">peer-peer</a> version as an alternative to this
|
||
|
client-server simulation. The <a href="TCPss.html">slow start</a> simulation
|
||
|
deals with only congestion avoidance.
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
Users simply send messages of a fixed size; the content of messages is not
|
||
|
identified. The medium maximum packet size is the protocol segment size.
|
||
|
Depending on this, messages may be sent as a number of fragments. Data
|
||
|
transfer is also subject to the current window size of the receiver, and may
|
||
|
be held up if the receiver's window becomes full.
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
To open a connection, a message is sent with the SYN (synchronise) flag.
|
||
|
To close a connection, a message is sent with the FIN (finish) flag.
|
||
|
Urgent messages may also be sent by selecting the PSH (push) flag as a
|
||
|
protocol parameter.
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
When data arrives, it is not immediately delivered to the receiving user
|
||
|
unless the PSH flag is set. Ordinary data is accumulated, and can be
|
||
|
delivered later ("Deliver octets to user"). If the destination's
|
||
|
receiving window becomes full, new requests to send data will be buffered.
|
||
|
When the receiving window opens again, this buffered data can be sent
|
||
|
("Send octets to peer").
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
Messages may contain a send sequence number (the offset of where the message
|
||
|
starts in the user's octet stream), an acknowledgement sequence number
|
||
|
(the offset of the next octet expected), and the current window (how many
|
||
|
octets can be received).
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
TCP is rather complex, so the simulation does not attempt to faithfully
|
||
|
reflect all its details. Although the main paths should work as expected, it
|
||
|
may be possible to get the simulation into unusual states in which it does
|
||
|
not behave correctly.
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
Things the simulation does not cover include the following. See advanced
|
||
|
guides to TCP for more information.
|
||
|
</p>
|
||
|
|
||
|
<ul>
|
||
|
|
||
|
<li>losing an ACK that opens up the window</li>
|
||
|
|
||
|
<li>"silly window" syndrome</li>
|
||
|
|
||
|
<li>adaptive retransmission strategies</li>
|
||
|
|
||
|
<li>congestion avoidance strategies</li>
|
||
|
|
||
|
<li>dynamic window management</li>
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
<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">User A Message Size (10 to 1000):</td>
|
||
|
<td>
|
||
|
<input type="text" name="userAMessageSize" value="100" size="4"/>
|
||
|
</td>
|
||
|
<td align="right">User A Push Flag:</td>
|
||
|
<td align="left"><input type="checkbox" name="pushA"/> </td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="right">User B Message Size (10 to 1000):</td>
|
||
|
<td><input name="userBMessageSize" size="4" value="300"/> </td>
|
||
|
<td align="right">User B Push Flag:</td>
|
||
|
<td align="left"><input type="checkbox" name="pushB"/></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="right">Protocol A Receive Window (10 to 1000):</td>
|
||
|
<td><input type="text" name="windowSizeA" value="500" size="4"/></td>
|
||
|
<td> </td>
|
||
|
<td> </td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="right">Protocol B Receive Window (10 to 1000):</td>
|
||
|
<td><input type="text" name="windowSizeB" value="400" size="4"/></td>
|
||
|
<td> </td>
|
||
|
<td> </td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="right">Medium/Protocol Segment Size (10 to 1000):</td>
|
||
|
<td>
|
||
|
<input type="text" name="maxSendPacket" value="200" size="4"/>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="right">Loss Rate (0.0 = lose none, 1.0 = lose any):</td>
|
||
|
<td><input type="text" name="lossRate" value="0.2" size="4"/> </td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="center" colspan="4">
|
||
|
<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 a client and a
|
||
|
server, protocol entities that support them, and a communications medium
|
||
|
(network) that carries messages. The server initially passively opens
|
||
|
(waits) for a connection. The client may actively open a connection to the
|
||
|
waiting server. After a connection has been made, the client and the server
|
||
|
may send data messages to each other.
|
||
|
</p>
|
||
|
|
||
|
<center>
|
||
|
|
||
|
<applet code="simulator.ProtocolSimulator.class"
|
||
|
archive="ProtocolSimulator.jar" width="750" height="700"
|
||
|
name="ProtocolSimulator">
|
||
|
<param name="protocol" value="TCP/cs"/>
|
||
|
</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>
|
||
|
|