> >I am trying to teach myself RMI for an internship I've got (I'm a
> > computer science student). I'm trying to compile sample code to see how
[quoted text clipped - 5 lines]
>
> Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/
Hmm...well, it's not working properly. How do you call the handle? I
have
quoteServer = "rmi://localhost//Quotes";
Thanks.
Matt Humphrey - 16 Aug 2006 00:04 GMT
>> >I am trying to teach myself RMI for an internship I've got (I'm a
>> > computer science student). I'm trying to compile sample code to see how
[quoted text clipped - 10 lines]
>
> quoteServer = "rmi://localhost//Quotes";
I don't have a short example to share, but these are the essential
components:
1) I define my server as an interface, such as (in a project shared by the
client and server)
public interface IServer extends Remote {
2) I implement the server (in a separate project) as
public class RMIServer extends UnicastRemoteObject implements IJukebox
3) I run rmic on the server and place the generated classes with the client
4) When the server starts up it registers itself as
RMIServer server = new RMIServer();
LocateRegistry.createRegistry(5001);
Naming.rebind("//:5001/MyServer", server);
5) The client gets the remote object by
IServer myServer = (IServer) Naming.lookup("//serverHost:5001/MyServer");
This is a very simple technique but it allows the export of additional
remote objects as well as callbacks from the server to the client. I no
longer remeber where I got the design from, but I've been using it (with
alot of success) for quite a while.
Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/