Jasper Protocol Simulator
(Java Simulation of Protocols for Education and Research)

See the download page to obtain this program


This protocol simulator provides:

You can immediately try out the online simulations to get a feel for what the simulator does. Your web browser will need to be configured to run Java 1.5 applets and (ideally) JavaScript.

The simulator is written in Java, and so can be used on many platforms with a web browser (subject to applet security) and/or a Java environment. To compile or extend the simulator requires a Java development environment such as the Oracle JDK (and ideally also Apache Ant). To run simulations requires a Java runtime environment such as the Oracle JRE. The code has been pre-built using JDK 1.8. However, it should compile and run using Java 5 onwards.

Translations of this page have been created for Estonian (Sonja Kulmala), Finnish (Fijavan Brenk), German (BestReviewsBase), Indonesian (Jordan Silaen, ChameleonJohn.com), Kazakh (Rauan Akhmetov, FeelGrafix.com), Latvian (Elze Gudmaniene), Macedonian (Jim Anastasovski), Romanian (Irina Vasilescu), Russian (Daniyar Nurgaliev, bestcarzin.com), Serbo-Croat (Anja Skrba), Slovak (Margareta Sliwka) and Ukrainian (In Depth Guide)


The simulator is provided as a Zip archive. The simulator unpacks to a directory called jasper-N.N according to version number. You might rename this to jasper for simplicity. The distribution contains:

Ant build file to manage the code
basic documentation
directory for protocol simulation pages and simulator JAR archive
example scenario files
directories for Java code (protocol, simulator, support)

Simulation as an Applet

The simulator can be used on various protocols by opening html/index.html in a web browser. This assumes you renamed the distribution folder as jasper. This will bring up the main page, with general instructions and a list of protocols that can be simulated. Your web browser will need to be configured to run Java applets and (ideally) JavaScript. Due to Java security restrictions you must authorise running of the pre-compiled code created by the University of Stirling. Alternatively, use an applet viewer on the files (though the JavaScript to set protocol parameters will not work).

Most simulations are in three-column format: two protocol entities (sender/receiver or A/B) and a communications medium (link or network). A few simulations add the sending and receiving users (applications) in outer columns. This format is useful for showing what the user sees; typically this is only part of what is happening in the protocol.

In a web browser, select an action by clicking on the list at the bottom right of the diagram. Actions are things like a user sending a data message or the medium delivering a protocol message. You are completely in control of the simulation. For example you may decide when to send messages, whether to acknowledge messages, and whether to deliver or lose messages in the medium. Since the simulation does not run in real-time, a timeout is possible as soon as a message has been sent.

The last action in the diagram is shown in red. Various protocol comments may also be noted in green the diagram, e.g. that a timeout occurred or that a message was ignored.

If you make a mistake, or just want to backtrack in the simulation, then click Undo. You can undo as many steps as you like, right up to the beginning of the simulation. Clicking on Redo will perform again the last undone step. Clear will restart the simulation with the current protocol parameters. If you click on Run the simulator will run automatically, making random choices for you. If you are not sure what to experiment with, this is an easy way of seeing the protocol in action. While this is happening, the Run button changes to Stop. Click on Stop to return the simulator to user control. You can continue at this point as if you had made all the automatic choices yourself.

The Print, Load and Save buttons are disabled since the simulations are running as applets. If you wish hard copy of the simulation, position the scroll bar in the simulation pane at an interesting point and print out the whole web page.

Some simulations have associated protocol parameters. To change the defaults that are shown, enter new values and click Change Values. In some cases, this will force the simulation to restart. The following is a screen-shot of a TCP client-server simulation, showing the protocol parameters and the main simulation controls.

TCP Simulation

Simulation as an Application

Running a protocol simulation as an application gives access to the Print, Load and Save buttons.

Print produces a hard copy of the whole simulation scenario. Note that individual pages cannot be selected for printing. The width of the printout is determined by the width of the on-screen window. Constants winWidth and winHeight in ProtocolSimulator define the initial window size. Constant maxHeight in TimeSequenceDiagram defines the vertical size of printed pages. The current sizes are appropriate for A4 paper. If necessary, change them for (say) US letter.

Load loads a simulation scenario file (with a name ending in .scn); this must be for the same protocol as you are currently simulating. It replaces the current simulation scenario (if any). Save saves the current simulation as a scenario file (with a name ending in .scn). If you are adventurous, you can create and edit your own scenarios using a text editor.

When the simulator is run as an application, a mandatory protocol name follows the main simulator class. Protocol parameters may then be given if required; protocols have defaults for these. Assume that the simulator has been built and is to be started from the top level of Jasper. The following (split here across two lines) will run TCP in client-server mode, with message window sizes other than the default:

    java -cp html/ProtocolSimulator.jar simulator.ProtocolSimulator
      TCP/cs windowSizeA=500 windowSizeB=300


The complete source of the simulator is provided. (Most files have Unix end-of-line.) The code should preferably be rebuilt using the Ant build.xml build file. ant -p will print help information about build targets. ant simulator will rebuild ProtocolSimulator.jar in the html directory. ant clean will remove all compiled class files and backup files, but preserving the JAR file. ant spotless will remove even this.

If you do not have Ant you will need to compile the Java source files manually and create a JAR file from the result.

To modify an existing protocol simulation or to write a new one will need a knowledge of the simulation framework. See the article An Interactive Visual Protocol Simulator for details of this and an extended example of how to develop a simulation. Once the framework is understood, a simple simulation can be developed in a day; complex protocols could take a week or two to develop.

Suppose that you want to develop a new simulation of the protocol EXP ('Example Protocol'). You would need to write EXP.java to instantiate the various entities in the protocol. For a simple protocol, you would then write EXPSender.java and EXPReceiver.java to define the behaviour of a sending or receiving protocol entity. More complex protocols could involve defining separate entities to handle the service interface and the protocol entity. It might also be necessary to define the formats of protocol messages and a variation on the underlying Medium to match these.

Due to increased Java security, applets need to be signed by a proper certificate. This has been done for the pre-compiled code. If you need to rebuild the code you will need your own keystore and digital certificate. See the Ant build file for how to use these.

Bear in mind that much of the development work was undertaken by students, so the level of comments in the code is somewhat limited in places. The ABP simulation is the simplest of the protocols and is a good place to start. The TFTP simulation is the best commented and best explained of the protocols. It illustrates nearly all the key points in simulation development.


This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation - either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful but without any warranty, without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details.


The protocol simulator was developed by Computing Science and Mathematics at the University of Stirling. Iain A. Robin undertook most of the development for his Master's project under Ken Turner's supervision. Paul Johnson and Kenneth A. Whyte contributed to the development of some of the simulations for their Master's projects. Dr. Peter J. B. King, Heriot-Watt University, provided helpful ideas and suggestions.