CMPU 375 - Project 2 Due: by 11:59 PM on Wednesday, October 26th

Project 2 - Reliable Transport Simulation

$Revision: 1.5 $

How the simulation works

The simulation is comprised of a Network object and several Host objects.  Network represents an internet, and simulates best-effort delivery of network datagrams.  Transmission and propagation delay are modeled, as well as packet loss and reordering.  (Note that Network does not introduce bit errors: you may ignore the possibility that packets are corrupted.)  A Host represents a single host on the network, with a single network interface with a unique address.  On each Host, one or more Process objects may be running.  Each Process simulates a network application, such as a client or server.

Each host has engines for two transport protocols: an unreliable datagram protocol (like UDP) and a reliable connection protocol (like TCP).  The engines, which implement the Transport interface, are used by Processes to send and receive data.  Your task is to implement the engine for the reliable connection protocol.

Implementing a Transport engine

Processes will use the Transport object to create socket objects.  For the reliable transport protocol, there are two kinds of sockets.  ServerSocket is used to listen for and accept incoming connections from clients.  ConnectionSocket is used to send and receive data over an already-established connection.  The socket objects should use the Transport object to implement the listen/accept operations and the send/receive operations.

When packets arrive from the Network, the Host will call the Transport's receiveFromNetwork method.  The Transport object should deliver the data to the correct socket.

Tasks

Your task is to implement a reliable transport protocol like TCP.  You will implement the createReliableTransport method in the TransportFactory class to create a new Transport object for a particular Host.

You protocol implementation should use a 3-way handshake for connection establishment.  It should use a sliding-window protocol for reliable transmission, with the send window size determined by the receiver's advertised window size, and by the current congestion window.  You should use TCP as a model for determining the congestion window size.  Use 64 KB receive buffers, and a MSS (max segment size) of 2048 bytes.

Getting Started

Import the file netsim.zip into eclipse (Import...->Existing Project into Workspace->Archive file), or extract it into a working directory.

A packet class called RDTPacket and a Transport class called ReliableTransport are provided to help you get started.  Feel free to modify them as you see fit.

The hard part of the project will be implementing your connection sockets to perform reliable data transfer.  You will need to carefully plan and implement the details of your protocol, such as

I strongly advise you to first implement a stop-and-wait protocol, where at most one segment is in sent at a time.  Once that is working correctly, you can then move on to pipelining, where multiple segments are in transit simultaneously.  Start using a small fixed window size---for example, 2 or 3 segments---and then move on to a more general approach with a congestion window.

Timing in the simulation is based on time steps.  You should use time steps as the basis for your retransmission timer (based on your RTT sampling, which should also be based on time steps).  You can always get the current time step by calling

host.getSimulation().getCurrentTime()

where host is a reference to the Host object your transport object belongs to.

To implement a retransmission timer, add code the the execute method of your Transport class.  This method is called once per time step.  You should use this method to check for sends that have timed out before an acknowledgment has been received.

Running the simulation

First, compile the project.  If you work on the project within Eclipse, this happens automatically.  From the command line, you can compile the project by executing the ant command in the root directory of the project (the one that contains the file "build.xml").

After the project is compiled, add the "bin" subdirectory to your CLASSPATH environment variable: from the "netsim" directory, run the commands

cd bin
setenv CLASSPATH `pwd`

The simulation is launched using a configuration file which describes the network characteristics, hosts, and processes.  These are in the "setup" directory.  A Process class called RDTTransfer will simulate a client/server bulk file transfer.  You can execute the simulation using RDTTransfer using the "rdttransfer.config" configuration file: from the "netsim" directory

cd setup
java edu.vassar.cs.cs375.netsim.Simulation rdttransfer.config

If the file transfer completes successfully, you will see the message:

Client received the file correctly!

Submitting your work

Go to the parent directory of the "netsim" directory containing your project, and run the following command:

submit375 netsim

You may submit as many times as you would like.  The last on-time submission will be graded.