Assignment 2 COIT20257 PDF

Title Assignment 2 COIT20257
Author Divyesh Patel
Course Distributed Systems: Principles and Development
Institution Central Queensland University
Pages 6
File Size 1.1 MB
File Type PDF
Total Downloads 15
Total Views 123

Summary

assignment...


Description

COIT 20257_S0274817

COIT 20257 - Distributed Systems: Principles and Development (Term 2 – 2016) Assessment Item 1: Assignment 2 Course Co-ordinator: Wei Li Lecturer: Ghulam Chaudhry Tutor: Ghulam Chaudhry

Prepared by: Divyesh Patel S0274817 Page | 1

COIT 20257_S0274817 1. Application brief: The application has made to calculate following things for user,

π

1. Value of with number of digit precision 2. To check whether the number is prime 3. To calculate greatest common divisor (GCD) among two numbers Requirements: 1. There are total 7 java files needed to use this application. 2. A PC to run the application 3. Command window to test class files, Netbean Java compiler to create client server TCP communication project using Socket and SocketServer Program: In this application model, server and client are communicating (in both the ways) using TCP protocol, the application is based on TCP protocol which is easy to use and implement and send data in bytecode form (bidirectional/full-duplex communication). Server is multithreaded in this model, server creates a port (say 8888) and waits for client/s to connect with, once client wake up and connection is being made (using server hostname/ip address and port number), the port 8888 will be reserved for other clients’ connection. Then serverclient are in connection and can start sending messages. In this application, user’s input is being sent from client to server using object in/out streams to serialize the object. 1. Client initiates the communication 2. Client sends request to server (request in the form of compute task, along with that it also sends user’s input in serialized from) 3. On other side, server will de-serialize the object in to task interface, downloads appropriate method from codebase repository and performs executeTask() method. After that, server will send the same object back to client. 4. Client will get result by calling getResult() method with the help of returned object 5. If client (user) forget to upload any class file among (pi, prime and GCD) server will through exception and at the same time client will also throws exception message.

2. Codebase: Codebase has three files Page | 2

COIT 20257_S0274817  CalculatePi.class  CalculatePrime.class  CalculateGCD.class

It is repository stored inside the server folder, whenever client request to perform particular compute-task, then using interface server will access particular class method and return result in the object from to client. 3. Test instructions are as follows: 1. The user of this application, first need to generate class files from given java files 2. Class files can be generated using command -javac 3. After generating class files, user needs to organize the class files directory in following way 

Client  ComputeClient.class  CSMessage.class  Task.class



4. 5. 6. 7.

Server  ComputeServer.class  CSMessage.class  Task.class  Server.Codebase  CalculatePi.class  CalculateGCD.class  CalculatePrime.class Start command prompt window Change the directory to Server folder…/Server/ Then use command java Server.ComputeServer Now server is up, and ready to listen from client

8. Then open another cmd window, change the directory to client folder Page | 3

COIT 20257_S0274817 9. Now, use command java Client.ComputeClient 10. The screen will popup menu like this as shown in figure below

11. Now, User interaction starts, if user enters 1

12. If user enters 2

13. If user enters 3

14. If user enters 4: User will come out of the application running mode

Page | 4

COIT 20257_S0274817

15. Invalid choice

16. Server window is performing some tasks while receiving receiving requests from client

When user try to exit from application, server file will throw IOException readline: Connection reset 17. If user forgot to upload any class files (among calculatepi/gcd/prime) and trying to give input to calculate (pi/gcd/prime), Sever will give error message and advice user to upload remainder file first then perform operation. Error messages: CalculatePi Client:

Page | 5

COIT 20257_S0274817 Server:

Error messages: CalculatePrime

Error messages: CalculateGCD Client:

Server:

Page | 6...


Similar Free PDFs