Java RMI lorrery

IN PROGRESS
Bids
5
Avg Bid (GBP)
£74
Project Budget (GBP)
£20 - £250

Project Description:
Use Java RMI to write a simple client-server application to play a Lottery. The player should select 6 distinct numbers in the range 1-50 and wins if any one of those numbers matches the single number generated at random on the server.

The objectives of this coursework are to:

• Write a program to play Lotto according to the rules above.
• Understand the invocation of methods on remote objects.
• Understand the production of distributed Java objects.

Summary of the Work
You will have to:
• Define the remote methods to allow the client to send the numbers 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.
• Programming
• Defining the Interface

In this coursework, firstly you define the server methods. The Lotto server receives and
reads the list of numbers selected by the client. Then it checks that this list is valid
(distinct numbers in the range 1-50):
• If not, return an error message to the client.
• If yes, make the lottery draw and see if the client has any winning
numbers. Return the result to the client.

2
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 LottoInfo 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 LottoInfoImpl class that implements the LottoInfo interface and the

LottoServer class that creates an object and registers it on the server.

1. Write the LottoInfoImpl class that contains the actual methods to receive the numbers.

2. Derive the class from the UnicastRemoteObject class

3. Create a LottoServer class with a method that creates a object. Register this object with the RMI remote object registry, name and bind it to a port using the Naming class and the rebind() method.

Programming the Client

Produce the LottoClient class that locates the server and invokes the remote methods. The command to start the client will be $ java LottoClient 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 RMI java 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 LottoInfoImpl 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.

Skills required:
Java, Software Architecture
About the employer:
Verified
Public Clarification Board
Bids are hidden by the project creator. Log in as the employer to view bids or to bid on this project.
You will not be able to bid on this project if you are not qualified in one of the job categories. To see your qualifications click here.


£ 100
in 1 days
Hire it2051229
£ 20
in 0 days
£ 30
in 1 days
Hire khaundaditya
£ 200
in 2 days
Hire msujithk
£ 20
in 1 days