Design-implement a rmi-based client / server communication

Assignment Help Basic Computer Science
Reference no: EM13934451

In this assignment, you are requested to build a system which allows a school pupil to practise multiple choice tests in math. Design and implement a RMI-based Client / Server communication system in Java, which will do the following:

  •  Client: c1. Connect to server via client_stub. c2. Read and display the prompt message sent (see step s2 in server) by the server. c3. Receives and displays the first math question plus three possible answers from the server. c4. User then selects and inputs only one answer and the client program sends the answer to the server. This process is repeated three times to complete all 3 questions from the server Questions database c5. After the test is over the client accepts and displays the test results and score from the server.
  • Server: . s0. [Initialization] Create a RMI-based server which implements a test interface s1.Wait for a client connection s2.When a client connection is accepted send an acknowledgement (a welcome message) as a sting of text. s3. From Questions database, server sends the first test questions plus three possible answers to the client. s4. Receives the answer from the client. Stores and evaluates the answer. This process is repeated three times. s5. After that the server sends all results and score to the client. s6. Close the connection to the client and then loop back and wait for another connection. Questions database: Q1: (A + B)*(A+B) 1. A*A + B*B 2. A*A +A*B + B*B 3. A*A +2*A*B + B*B (correct) Q2: (A + B)*(A - B) 1. A*A + 2*B*B 2. A*A - B*B (correct) 3. A*A -2*A*B + B*B Q3: sin(x)*sin(x) + cos(x)*cos(x) 1. 1 (correct) 2. 2 3. 3 Note: All the communication between the Client and the Server should be in the form of strings. ! Programming Notes Here are a few tips/thoughts to help you with this assignment:

• You must use the three questions from Questions database (see above).

• Define the remote methods to allow the client to send the answers to the server.

• Implement these methods as a remote object.

• Write a client to invoke the remote methods.

• Use the rmic program to produce a stub and a skeleton.

• Use the rmiregistry tool to register the server.

  •  Defining the Interface In this coursework, firstly you define the server methods. The server receives and reads the list of answers selected by the client. Then it checks that this answer is valid (distinct numbers in the range 1-3):

• If not, return an error message to the client.

• If yes, check answers and see if the client has answered correctly, then return the score to the client. The server is comprised of an interface and a class. The interface provides the definition for the methods that can be called from the client. Essentially the interface defines the client's view of the remote object. The class provides the implementation. Define these methods in a Java TestInfo interface. Derive the interface from the Remote class or from java.io.Serializable interface (The interface must extend from java.rmi.Remote. All the method declarations must include the throws java.rmi.RemoteException clause).

  •  Implementing the Remote Objects on the Server Write the TestInfoImpl class that implements the TestInfo interface and the TestServer class that creates an object and registers it on the server. 1. Write the TestInfoImpl class that contains the actual methods with questions and to receive the answers. 2. Derive the class from the UnicastRemoteObject class 3. Create a TestServer class with a method that creates an object. Register this object with the RMI remote object registry, name and bind it to a port using the Naming class and the bind() or rebind() method.
  •  Programming the Client Produce the TestClient class that locates the server and invokes the remote methods. The command to start the client will be $ java TestClient rmi://machine/remote_object Where the URL refers to the registry(usually on the same machine that the server runs on, probably localhost). Retrieve the remote object using the Naming class, by passing the use of the registry to the lookup() method. Then make the remote method call on this object.
  •  Producing the Distributed Objects Finally, compile and run the distributed objects. 1. Compile all the classes you have written. 2. Your Java RMI programs are only a part of the application. It uses two other pieces of code called the stub and the skeleton. These reformat the method parameters and encapsulate them into a RMI data unit. This process is called marshalling. Run the command rmic TestInfoImpl to generate the stub and the skeleton. 3. Launch the registry rmiregistry. Be sure to run the registry in the RMI server directory that contains the stub and skeleton. 4. Run the server and the client on a same machine and directory. Then try to run the client and the server on two different machines. ! Submission You should submit your code both on paper and on disk (hand in the assignment to the undergraduate office in the normal way with floppy disk containing only the *.java source code). Write a report on the design and implementation of your solution and answers, showing code and results: (i) a class diagram outlining the class structure for your proposed solution. (ii) a set of summary tables describing the fields, constructors and methods for each class. (iii) a print out of the Java source code of your complete program. ! Extensions A small number of marks are reserved for extensions. These could be to have GUI on client and server sides which send the range of possible choices to the client and validate entries, or to be able to specify a security manager which determines its security policy by using the RMISecurityManager.

Reference no: EM13934451

Questions Cloud

Measure mothers socioeconomic status : Summary- 1 paragraph on the topic and findings of the paper pros: (bullet points) e.g. - -The article was clearly written with clear figures and graphs - - The questionnaire used did not measure mothers socioeconomic status.
Would an unexpected increase in sales and production result : Would an unexpected increase in sales and production result in under applied or over applied overhead? Explain.
Character of the borrower-quality of information provided : Explain how the following situations can shed light on the question, “What is the character of the borrower and quality of information provided?” Significant number of Better Business Bureau complaints.
Design-implement a rmi-based client / server communication : In this assignment, you are requested to build a system which allows a school pupil to practise multiple choice tests in math. Design and implement a RMI-based Client / Server communication system in Java, which will do the following:
Define counter controlled repetitive control structures : We can replace any code that uses a for loop with a while loop. Would not it be simpler to get rid of the for loop and use the while for everything? Do you think this would be a good idea? Why or why not?
Calculate the economic order quantity : Louise Manufacturing uses 3,100 switch assemblies per week and then reorders another 3,100. The relevant carrying cost per switch assembly is $13.00, and the fixed order cost is $1,550. Calculate the economic order quantity.
Characteristics of effective managers and leaders : an analysis of how management and leadership roles differ in terms of supporting an organization to set and achieve goals. Provide your rationale, identifying specific characteristics of effective managers and leaders
Best estimate of the value of this income property : Income Property Valuation: Given that a property has the following information: a potential gross income of $1,550,000, net operating income of $900,000, a market capitalization rate of 8.25%, and a market gross income multiplier (GIM) of 11, what is..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Suggest an agile project management framework

Create a project plan for this project based on your proposed framework through the use of MS Project or Excel. Note: List all major milestones, resources, tasks and dependencies. Include tools such as risk log to enhance your project plan.

  Validate the information

When all the information is valid, a confirmation screen is displayed. The operator visually confirms that the data are correct and either accepts the transaction or cancels it.

  Definition of a set of mutually exclusive roles

definition of a set of mutually exclusive roles, such that if a user is assigned to one role in the set, the user may not be assigned to any other role in the set

  Design a shopping page with 5 products

Design a shopping page with 5 products on it. Each product has one image, product title, product description, and price.  You may add necessary buttons, page heading, and background.A. When the page first loaded, display exactly 5 product items with ..

  Write a class encapsulating the concept of a course

Write a class encapsulating the concept of a course, assuming a course has the following attributes; a doce (for instance, CS1), a description, and number of credits (for instance, 3.) Include a constructor, the accessors and mutators, and methods..

  In an overview, describe the multics operating system

In an overview, describe the Multics operating system project which was under taken at MIT in the 1960's. Identify any impacts and influences Multics has had on modern day trends in developing secure and trusted software.

  Practice cost-benefit question zhengxi

Practice Cost-Benefit Question Zhengxi, aged 21, is considering whether or not to go to university for four years. For simplicity assume that he is paid, and pays tuition, at the beginning of each year, and that his alternative income streams are bot..

  The hyperlink from the homepage to the other pages

The hyperlink from the homepage to the other pages should be contained in an unordered list.

  Advantages of verifying the hash function

Explain the advantages of verifying the hash function of the bit torrent peer to peer network.

  Flight availability request application

Define a simple Web Service in WSDL that returns flight information regarding flights of a particular flight operator, see the first question

  Security professionals to find information about threats

Analyze the selected two (2) resources that are available for security professionals to find information about threats and / or malware active today. Justify your belief these resources are helpful for security professionals.

  How could a business use information technology

How could a business use information technology to increase switching costs and lock in its customers and suppliers? Use business examples to support your answers

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd