Java RMI simple client-server application

I need to know how to write a simple java RMI server - client application to play a lottery. The player shuld select 6 distinct numbers in the range 1-100 and wins if any one of those numbers matches the single number generated at random on the server.
The lotto server receives and reads the list of numbers selected by the client, then it checks that the list is valid, if not, it return an error message and if yes, the lottery draw and see if the client has any winning numbers. The server then returns the result to the client.
chris_black23Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
We can't produce homework code. Break the problem down. Look for the Sun tutorials
0
CEHJCommented:
One thing you can do is to produce the random classes independently of the RMI stuff to begin with
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mtcmediaCommented:
I would do as CEHJ says, you can go and create your "template" RMI classes which are standard no matter what your going to do. Look at Suns pages, once you have that then you can start adding the functionality you need.
0
Dejan PažinHead of SW DevelopmentCommented:

And dont forget: Using java 1.5, all the RMI stuff can be generated for you. Try it with IntelliJ IDEA, you can get a trial licence. All you need to do is, check: Compiler --> RMI Compiler --> Enable RMI stubs generation.

The only thing you need to do is create an interface, which extends Remote, and implement it. And of course start the rmiregistry, register the object and then call the methods on it from the client. This is how you do it for the server side:

         Registry registry = LocateRegistry.createRegistry(portNo);
         registry.bind("NameForYourServerObject", yourServerObject);

And then call it on the client:

         Registry registry = LocateRegistry.getRegistry("localhost", portNo);
         serverObject = (ServerObjectClass) registry.lookup("NameForYourServerObject");

It really is that easy.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.