Set your eclipse workspace to the top level, which is the project root directory. Eclipse should automatically recognize and import the project.
If that did not work, follow these steps: Ensure the Java Perspective is open in Eclipse.
Create the Core project:
New
-> Java Project
core
client
, server
, and errorSimulator
.The client, server, and errorSimulator projects will now show errors.
The core
project is required to be on the buildpath of the other
three projects. To add the core
project to the buildpath or client
:
client
projectproperties
java build path
projects
tabadd
buttoncore
projectserver
project and the errorSimulator
project.Eclipse should now be configured properly.
Note All transfers take place from the present working directory
of the respective project. For example a write operation from the client
will write from project-root/client/
There is a change directory command cd
which allows you to move the
present working directory to a different folder. For example
cd ../
will change the directory to the directory above the current
project. All directory changes are relative to the original project
directory. To return to the project directory, simply type cd .
shutdown
in the servers command line interface.cd
. All read and writes will be relative to the new foldershutdown
in the error simulators command line interface.TFTP Error Simulator
<t> must be either 'ack','data', or 'req'
<n> starts counting at 1 (The first data packet is data 1).
Each simulation runs for a single transfer. The mode reset to norm after each transfer
The server and client timeout is 2400ms
Commands:
help Prints this message
shutdown Exits the simulator
norm Forward packets through without alteration
rend Removes the end byte of the next request packet.
ie Removes the 0 Byte after Mode
rrs Removes the Request Seperator of the next request
packet. ie Removes 0 Byte after Filename
mode <m> Changes the mode of the next request packet
csa <t> <n> Changes the sender TID of a specified packet
op <t> <n> <o> Changes the opcode of a specified packet
bnum <t> <n> <o> Changes the block number of a specified packet
cl <t> <n> <o> Changes the length of a specified packet
delay <t> <n> <o> Delays the specified packet by a number of
timeouts
duplicate <t> <n> Sends a duplicate of the specified packet
drop <t> <n> Drops the specified packet
req
then the packet number must be 1
for desired functionalityBy default, client will connect directly to the server when run through eclipse.
To have the client run through the error simulator, run the client with the -t
command line argument.
help
in the cli. read
followed by a space and the filename.write
followed by a space and the filename.cd
. All read and writes will be relative to the new folderserver
followed by the server's IP or hostname. The default server address is localhost.shutdown
.To enter a command line argument in eclipse:
Run as
-> Run Configurations
Arguments
tab on the right hand sideProgram Arguments
text box, add -t
During a read request, the client will send a request to read a file. If the
file does not exist then the server will spawn a special Error Responder
thread which will respond with an error code 1. This indicates to the client
that the file does not exist to on the server.
Before sending a request to write a file to the server, the client performs a check to find the desired file. If the file cannot be found then the client immediately notifies the user and never sends a request.
When a file request is made to the server for a file that cannot be read then
an Error Responder
will immediately respond with an error code 2. Alternatively,
if the client does not have permission to write to its destination folder then
the read request will never be sent.
If a client does not have permission to access a local file then a request will never be sent and the user will be notified immediately. If the client sends a write request and the server cannot write to its destination folder then it will respond with an error code 2.
If a client runs out of disk space during a transfer then it will terminate the transfer and send an error code 3 to the server.
If a server runs out of disk space during a transfer then it will terminate the transfer and send an error code 3 to its clients
If an endpoint receives a TFTP message that contains an invalid opcode then it will respond with an error code 4 packet.
If an endpoint receives a packet from a sender that differs from the one that is currently performing transfer then it will respond with an error code 5 to the unknown sender and continue the transfer.
If a request is made to read a file from a server that already exists on a client then the client will immediately notify the user and terminate without sending a request.
If a server receives a request to write a file that already exists, it will respond with an error code 6 and never start the transfer.
The file TeamResponsibilities.txt describes the responsibilities of each team member for this iteration. The document is split into a different section for each member, and lists their contributions.
The file TestPlan.pdf describes the test procedure followed to ensure correct functionality of the program. It also describes the command line arguments and cli commands available for the client, server, and error simulator. The javadoc for each project is located in that projects doc folder.
There is a top level folder called ucms where the ucm diagrams are located.
The source code for this deliverable is split up into four main projects: core, client, errorSimulator, and server.
The core project contains all of the common core functionality shared between projects. The core project contains all code relating to the TFTP standard. This project is a dependency for all other projects.
The client project contains the code specific to the client application.
The errorSimulator project contains the code specific to the Error Simulator application.
The server project contains the code specific to the server application.
This diagram demonstrates the flow of a request from the client to the server and its response. This is generic, as the same logic is used for a read and a write request.
This shows the steady state transfer when reading from a file on the server to the client.
This shows the steady state transfer when writing to a file on the server from the client.
The client project contains only the client class. This class is responsible for parsing command line arguments, starting the clients command line interface, and starting the client. This contains the main method for the client application.
The error simulator project is responsible for relaying datagram packets
between the client and the server. The main method for the error simulator
application is contained in the ErrorSimulator.java
class.
This package holds the error simulation controller and command line interface for the error simulator. It handles all sending and receiving of request packets
This package has all of the simulation streams that decorate a basic stream to modify a transfer.
This package has simulation threads which run an individual simulation for a request
The server project contains only the server class. This class is responsible for starting the servers command line interface, and starting the server. This class contains the main method for the server application
The core project contains functionality needed by the client, server, and errorSimulator projects. It has several packages: core.cli, core.ctrl, core.log, core.net, core.req, and core.util
This package contains the generic implementation of the command line interface.
This package contains the parent classes of the client, server, and errorSimulator. Its purpose is to abstract client and server logic to allow it to be reused by the error simulator.
This package is responsible for setting up a logger that allows a global logging severity level to be defined.
This package contains the core file transfer logic and network operations. This includes actions such as writing to sockets, reading from sockets, etc.
This package contains the logic for encoding and decoding TFTP protocol messages.
This package contains two utility classes: ByteUtils.java and Worker.java
This class contains static methods to find the index of a value in a byte array, and to convert a byte array to a String.
This is an abstract base class for long running asynchronous jobs.
For further details on any specific class from a core package, refer to the provided javadoc.