(Java Simulation of Protocols for Education and Research)

Simulator Logo

See the download page to obtain this program

A Serbo-Croat translation of this page was produced by Anja Skrba, and an Armenian translation of this page was produced by Gajk Melikyan.


This protocol simulator provides:

Additional simulations have been created under contract to Pearson Education for Data and Computer Communications by William Stallings. These are not available in the public distribution of Jasper, but are available via the Pearson web site (on a subscription basis).

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 nearly any platform with a web browser and/or a Java environment.


Note that the online and pre-built code has been compiled using JDK 1.5. It will also compile and run using (say) JDK 1.6.

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

build.bat, clean.bat
MS DOS batch scripts to manage the code
Ant build file to manage the code
basic documentation
directory for web pages and simulator JAR archive
directories for Java code (protocol, simulator, support)

Simulation as an Applet

The simulator can be used on the downloaded files by pointing a web browser at .../jasper/html (or possibly .../jasper/html/index.html). 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 1.5 applets and (ideally) JavaScript. 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 that 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 the TCP 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 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 are likely to 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 but are using MS DOS/Windows, you can instead use the batch files build.bat and clean.bat. These perform the basic tasks of creating the simulator JAR file and tidying up build files.

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.

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 2 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.

You may re-distribute this software provided you preserve this README file. Bug reports should be sent to Ken Turner, who would also appreciate receiving any corrections or code for new protocols.


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.


Up Arrow Up one level to Communications Utilities

Web Ken Turner Home   Email    Search Search Web Pages

Last Update: 30th March 2016
URL: http://www.cs.stir.ac.uk/~kjt/software/comms/jasper.html