COIT13229 Applied Distributed Systems - Assessment 1
This assessment item is designed to test your understanding in Java TCP/UDP networking, Java Object Serialization\Deserialization, file reading and writing using client/server application development.
A fitness club would like to create an application that allows members to register for club membership online. The application should be implemented using client/server model, where client can register for membership by providing their details (such as name, address, phone number, etc....) using a program for client. The details should then be sent to a server program, where the details are saved into files. The server program should allow for multiple clients to communicate and save details concurrently. The application should also have another client program for club manager to access and view the details of all existing members in the data files.
You can use the following class descriptions as a guideline for your design.
The program should have a class for Member, which stores the member details. You can design your own properties of Member class, but at least the following properties should be included: First Name, Last Name, Address, and Phone Number. Constructor(s) and Get and Set functions should be implemented in this class.
The Client/Server programs for client to enter membership information should be implemented using TCP stream communication. (At minimum) Two java files should be used
TCPClient: This program ask user to enter details for members and send those details to TCPServer. The data sent to server can be in String format where the properties are separated by colon symbol “:”, such as “Firstname:LastName:Address:Phone”. Implementation of Socket, DataInputStream and DataOutputStreamfor TCP Connection should be used in this class where appropriate. The program should allow client to enter details multiple time for multiple members.
TCPServer: This server receives data from TCPClient and writes member details into a text file named “memberlist.txt”. After saving details, the server should send message(s) back to TCPClient for feedback. The server program can keep running to wait for future communication from TCPClient. The server program should allow for more than one member to communicate at the same time.
In addition, there should be a Timer function in the TCP Server program to convert the data in memberlist.txt into Java Object Serialization and save into another data file named “memberlistObject” every 2 seconds. Appropriate code for Java Object Serialization should be
used in this function. (Refer to Week 3 Lab for reference about Java Object Serialization and Week 5 Lab for reference about Timer function)
The socket number used in the TCP Connection should be in the following format “11xx” where xx is the last 2 numbers on your student ID.
3. The Client/Server programs for Manager to retrieve member details should be implemented using UDP datagram communication. (At minimum) Two java file should be used
UDPClient: This program allow manager to send a request containing the file name “memberlistObject” to UDPServer and then print out member details after receiving response from the server. Implementation of Socket and DatagramPacket for UDP Connection should be used in this class where appropriate.
UDPServer: This server receives the request from UPDClient and attempt to read Java Objects from the file “memberlistObject”. Appropriate code for Java Object Deserialization should be used in this program. The object data are then sent back to client using DatagramPacket.
The socket number used in the UDP Connection should be in the following format “22xx” where xx is the last 2 numbers on your student ID.
Your program should check user inputs for potential error and allow user to re-enter details where appropriate. Exception and input error handling should be implemented within your program where necessary. The source code should be formatted properly following good programing practice (appropriate variable names, indentation, comments, etc....)
The following screenshots show example outputs of the above program. You should only use these as references. Your program outputs can be similar but not necessarily the same. You should customize the messages on clients and servers for your own program.
Assume that TCPClient is run on two Java Virtual Machines:
Output on TCPServer:
The data are also saved into a text file by TCPServer:
The details in the memberlist.text are converted to into Java Object and saved in memberlistObject file every 2 seconds:
Output of UDPClient:
Output of UDPServer:
After the implementing the program, prepare an end user instruction and test manual. Run the program and take screenshot of program outputs, provide description on the outputs and how your program works. The test should demonstrate that your TCPServer can accept connection with more than one TCPClient. The test should show at least 4 members entered and saved into the files. Screenshots of your memberlist.txt and memberlistObject files with the member details should be provided.
You should submit one Zip file containing the following files using the Moodle online submission system, by the due date:
Member.java – Source code for the Member class
TCPClient.java – Source code for the TCPClient class
TCPServer.java – Source code for the TCPServer class
UDPClient.java – Source code for the UDPClient class
UDPServer.java – Source code for the UDPServer class
memberlist.txt – The text file containing member details after your test.
memberlistObject – The Java Object file containing member details after your test.
Report.docx – A document file containing details as outline above.