This assignment requires you to write a Java program implementing client-server communi- cation using Remote Method Invocation.

Explanation of coursework

Imagine you are designing a distributed voting applications: While the server is running, a client can connect to the server and vote for one of the 3 choices (by means of the method vote, see below). After voting the client can requenst the voting results so far.

Basic Java RMI communication

As a first step, you are required to implement client-server communication only. At this stage you can ignore the program logic, e.g., the client will be able first request the voting results and then vote. For your convenience, I a suggest the following remote object interface (however, feel free to modify it to your needs):

public interface vote extends java.rmi.Remote {
public void vote (int choice) throws java.rmi.RemoteException;
public String getVotingResults() throws java.rmi.RemoteException;

You have to implement the following classes.

  • Class remoteVoteImp.java : This class has to implement the remoteVote interface.
  • Server side: The server has to initiate and register the remote object.
  • Client side: The client should offer the user an opportunity to vote for one of the three choices, submit the choice to the server, and request the voting results.

Program logic

You have to extend the communication model and implement server logic so that the server will only allow a client to perform actions in the correct order. That is, the client will only be able to request the voting results after it sends it’s own reply.

Hint. Such functionality can be achieved, for example, by assigning every client a ticket (a randomly generated integer number). A client without a ticket will be denied all communi- cation. A client first requests a ticket from the server and then passes this ticket as an extra parameter to all remote methods. When the server issues a ticket, it saves the ticket to a datastructure (for example, a hash table) so that all remote methods (getVotingResults, vote, etc) will be able to check that the ticket is valid.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.