====================================================================================================
README File for Project - Iteration 4 - TFTP
Derek Dorey
Lee Fisher
Lexi Brown
Scott Hanton
====================================================================================================
USING THE TFTP
OVERVIEW
This is a tftp client/server that is being used to transfer file from the client to the server.
It also displays information about the transfer process. The client is setup on Port 69 in the
Normal run and Port 23 otherwise, it either perform a read request or write request
The transfer process starts with a request to send or receive file and when this request is granted,
a file of block length of 512 bytes is sent, each data packet is first acknowledge
by an acknowledgement packet before the next packet is sent.
====================================================================================================
RESPONSIBILITIES
Richard Hanton
Iteration 1:
- Client side
Iteration 2:
- Created the timing diagrams for error codes 1, 2, 3, and 6.
- Created the UML diagram for the state of our project at iteration 2.
- Helped team members fix some small issues within client and server.
Iteration 3:
- Updating the client and server side to handle lost packets, delayed packets and duplicate packets
Iteration 4:
- Updating the client and server to verify requests and handle tid changes
Iteration 5:
- Fixed bugs from previous iterations
- Prepared test files to be used during demo
Derek Dorey
Iteration 1:
- UCMs for client/server scenarios
Iteration 2:
- Server side error handling
Iteration 3:
- Fixing iteration 2 issues
- UML and timing diagrams
- Testing and confirming duplicate, delayed and lost packets in the error simulator
Iteration 4:
- Added commands to change file/server directories during runtime
- Fixed issues from iteration 1-3
- Timing and uml diagrams
Iteration 5:
- Testing all functionality
Lee Fisher
Iteration 1:
- UMLs for all classes
Iteration 2:
- Client side error handling
Iteration 3:
- Fixing iteration 2 issues
- UML and timing diagrams
Iteration 4:
- Added corrupting request error simulations
- Added missing diagrams from iteration 3
Iteration 5:
- Testing all functionality
Lexi Brown
Iteration 1:
- Server side and client interface
Iteration 2:
- Updating readme
- Fixing iteration 1 issues
Iteration 3:
- Updating readme
- Building error simulator console interface
- Implementing duplicate, delayed and lost packets in the error simulator
Iteration 4:
- Added tid change error simulation
Iteration 5:
- Implementing server IP changes on client
====================================================================================================
RUNNING THE PROGRAM
Client Side:
1. Import project into Eclipse.
2. Run the ClientInterface
Server Side:
1. Import project into Eclipse.
2. Run the Server
Error Simulator:
1. Import project into Eclipse.
2. Run the ErrorSimulator
RUNNING THE PROGRAM IN TEST OR VERBOSE MODE
Client:
While ClientInterface is running you can type in the following commands:
* set verbose on
* set verbose off
* set mode normal
* set mode test
Server:
While the server is running you can type in the following commands:
* verbose on
* verbose off
* help
* quit
ErrorSimulator:
While the ErrorSimulator is running you can type in the following commands:
* verbose on
* verbose off
* help
* quit
* mode <mode>
* file <file>
* first <request> <position>
* last
* sep
* opcode <request> <position> <new_request>
* block <request> <position> <new_position>
* tid <request> <position>
* delay <request> <position> <delay>
* dup <request> <position> <delay>
* lose <request> <position>
IMPLEMENTATION DETAILS
-
Client.java implements the client side of the TFTP as follows:
- Create a read request or write request base on the request type.
- Creates a socket, generate a random port number and bind it to the socket.
- Connect to the server through the port number and IP Address of the server.
- Generate array byte and send to server for a request type and file.
- Create Datagram packet and send the message, message length, IP Address and port number to server.
- If it is Read request, save incoming file packet to path and print it to the terminal.
- Check the length of datagram to check if it was the last packet.
- Check the name of the file and send file to the server if it doesnt already exist.
- Send Acknowledgement to the server when the block is received
-
ClientInterface.java implements the client side of the TFTP as follows:
- Create a Client class
- Print operation information to the terminal
- Convert the buffer readline to integer and print it to the terminal
- Send File based on the integer value of the buffer reader.
-
Server.java implements the server side of the TFTP as follows:
- Create a datagram socket and binds it to port 69
- Starts listening on the socket
- Wait for client to connect and create thread to handle it.
- Accept datagram packet from the socket and process the received datagram.
- Start the server thread
- Listen for connections and start another to wait for console input to shutdown server
- Close all the threads when they are finished.
-
ClientConnection.java
- Handle request and Create response
- Create new server socket and send packet
- wait to receive datagram packet, block until a datagram packet is received.
- Process the received datagram packet.
- Package file to be read, write to specified file and create new file if file doesnt exist.
- Verify that the first 4 bytes are ACK and hat the request is valid.
- Return the name of the file.
-
ErrorSimulator.java
- Create a datagram socket and binds it to port 23
- Starts listening on the socket
- Wait for client to connect and creates thread to handle it.
- Accept datagram packet from the socket and pass the received datagram to the server.
- Wait for server to send back response and then pass response to client
- Continues to pass data between client and server until file transfer is complete.
-
ErrorThread.java
- Abstract class using for making error simulating threads
-
NormalThread.java
- Accept datagram packet from the socket and pass the received datagram to the server.
- Wait for server to send back response and then pass response to client
- Continues to pass data between client and server until file transfer is complete.
-
LostThread.java
- Loses a specific packet based on user input
- Accept datagram packet from the socket and pass the received datagram to the server.
- Wait for server to send back response and then pass response to client
- Continues to pass data between client and server until file transfer is complete.
-
DelayThread.java
- Delays a specific packet based on user input
- Accept datagram packet from the socket and pass the received datagram to the server.
- Wait for server to send back response and then pass response to client
- Continues to pass data between client and server until file transfer is complete.
-
DuplicateThread.java
- Duplicates a specific packet based on user input
- Accept datagram packet from the socket and pass the received datagram to the server.
- Wait for server to send back response and then pass response to client
- Continues to pass data between client and server until file transfer is complete.
-
BlockThread.java
- Changes the block number of a specific packet based on user input
- Accept datagram packet from the socket and pass the received datagram to the server.
- Wait for server to send back response and then pass response to client
- Continues to pass data between client and server until file transfer is complete.
-
FileThread.java
- Changes the file of a specific packet based on user input
- Accept datagram packet from the socket and pass the received datagram to the server.
- Wait for server to send back response and then pass response to client
- Continues to pass data between client and server until file transfer is complete.
-
FirstThread.java
- Removes the first byte of a specific packet based on user input
- Accept datagram packet from the socket and pass the received datagram to the server.
- Wait for server to send back response and then pass response to client
- Continues to pass data between client and server until file transfer is complete.
-
LastThread.java
- Removes the last byte of a specific packet based on user input
- Accept datagram packet from the socket and pass the received datagram to the server.
- Wait for server to send back response and then pass response to client
- Continues to pass data between client and server until file transfer is complete.
-
ModeThread.java
- Changes the mode of a specific packet based on user input
- Accept datagram packet from the socket and pass the received datagram to the server.
- Wait for server to send back response and then pass response to client
- Continues to pass data between client and server until file transfer is complete.
-
OpCodeThread.java
- Changes the op code of a specific packet based on user input
- Accept datagram packet from the socket and pass the received datagram to the server.
- Wait for server to send back response and then pass response to client
- Continues to pass data between client and server until file transfer is complete.
-
SeparatorThread.java
- Removes the file and mode separator of a specific packet based on user input
- Accept datagram packet from the socket and pass the received datagram to the server.
- Wait for server to send back response and then pass response to client
- Continues to pass data between client and server until file transfer is complete.
-
TIDThread.java
- Changes the TID of a specific packet based on user input
- Accept datagram packet from the socket and pass the received datagram to the server.
- Wait for server to send back response and then pass response to client
- Continues to pass data between client and server until file transfer is complete.
OTHER FILES
-
Logger.java
- This is a class that logs all packets coming in and going out
- It logs the contents of the packet, it's length, type (i.e, RRQ, WRQ, ACK, etc), block number, mode, etc
-
Variables.java
- Holds all the common variables used by the client and sever
-
test.txt
- A short file for the client to test writing
-
text.txt
- A long file for the client to test writing large files
-
test2.txt
- A short file for the client to test reading
-
text.txt
- A long file for the client to test reading large files
-
long.txt
- A super long file for the client to test writing very large files
-
UMLpt1.JPG
- Part 1 of the UML (Unified Modeling Language) for each classes
-
UMLpt2.JPG
- Part 2 of the UML (Unified Modeling Language) for each class
-
Error Code *.jpeg
- All the timing diagrams from errors while reading or writing
-
Timeout - *.jpeg
- All the timing diagrams for timeout scenarios
-
*-block.txt
- Text files that are exactly n blocks
-
BlockUtil.java
- Utility for converting bytes to int and int to bytes
-
VerifyUtil.java
- Confirms if the request has the correct format
-
TestLogger.java
- This is a class that logs all packets coming in and going out
TERMINATION
-
A data packet size less than 512 byte is sent to mark the end of a transfer.
-
If some errors occur due to an invalid request then instead of sending an error
packet and corrupting the program, a stack trace is printed.
LIMITATIONS
ASSUMPTIONS
FEATURES