This assignment requires you to write a Java program implementing client-server communi- cation using Remote Method Invocation.
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.
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):
remoteVote.java:
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.
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.