Simple Rmi Program Using Netbeans For Php

Active6 years, 6 months ago

Remote Method Invocation (rmi) is an API that provides a mechanism to create distributed application in java. A tutorial describing how to create a simple, two-tiered web application that connects to a MySQL database in NetBeans IDE. Partner program Help millions of developers do their best work. Apps by GitHub. A simple example of a Java-RMI setup using Maven. Project Setup. There are three subprojects in this example: RMIClient, RMIServer, and RMIInterfaces. These should be self-explanatory. The server sets up a basic class to.

I am trying to make a very simple chat program using RMI (no GUI's) but i am struggling for ideas.How do i register clients when they connect to the server?When i use

Plugin

RemoteServer.getClientHost()

Download the latest version of Canon CanoScan D660U drivers according to your computer's operating system. All downloads available on this website have been scanned by the latest anti-virus software and are guaranteed to be virus and malware-free. Canon d660u twain driver.

all this does is show the ip address (and they are the same for all clients that connect from the same computer (from multiple command windows).What i am trying to implement is this: when a client logs on he is shown a switch-case menu and ift they press

  1. they get a list of connected clients.

  2. sendMessage(client, String)

But i do not know how to identify individual clients?

And when i do, how do i show a string only on that client's window ? Install hp scanjet 5590.

Thanks,

Research:(i have looked at ideas on the web but a lot of them are more advanced than i want. This is a simple application and i do not want to complicate it / copy code i dont understand).There are previous questions on SO but with 0/1 answers (not very popular topic!) or not helpful!

DelvinDelvin

1 Answer

Looks like i found what i was looking for:

RMI Callback

Basically making every client a server, so the server can respond as well as receive messages.

I have been directed to a resource that might help:

DelvinDelvin
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Not the answer you're looking for? Browse other questions tagged javachatrmi or ask your own question.

Description

Simple Rmi Program Using Netbeans For Php Development

Please see attached file for full program details and criteria:
Program Description:
You will use Java RMI to write a simple client-server application to play Lottery.
• The player should select 6 distinct numbers in the range 1-50 and
o Wins if any one of those numbers matches the single number generated at random on the server.
Summary of the Program:
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 Criteria:
1. Defining the Interface
• Firstly 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):
o If not, return an error message to the client.
o If yes, make the lottery draw and see if the client has any winning numbers.
o Return the result to the client.
The SERVER is comprised of an INTERFACE and a CLASS.
• THE INTERFACE:
o Provides the definition for the methods that can be called from the client.
o Essentially the interface defines the client's view of the remote object.
• THE CLASS:
o Provides the implementation.
o Define these methods in a Java LottoInfo interface.
o Derive the interface from the Remote class or from java.io.Serializable interface (The interface must extend from java.rmi.Remote.
o All the method declarations must include the throws java.rmi.RemoteException clause).
2. 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.
3. 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
o (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.
4. Producing the Distributed Objects
Finally, compile and run the distributed objects:
1. Compile all the classes.
2. Your RMI java programs are only a part of the application.
a. 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. Run the command rmic LottoInfoImpl to generate the stub and the skeleton.
3. Launch the registry rmiregistry.
a. 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.
a. Then try to run the client and the server on two different machines.
Other Criteria:
• All coding should have comments written on them making the code easy to understand
• Source code should be included
• A small user guide to be included on how to use the program
• Using NetBeans to create the program (if possible)
• Simple program that fulfils all the points mentioned above in the Programming Criteria
1
1
0%
21 Feb 2012

New Proposal

Create an account now and send a proposal now to get this project.

Simple Rmi Program Using Netbeans For Php Download

Sign up