aspose file tools*
The moose likes Beginning Java and the fly likes Sockets With Rmi Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Sockets With Rmi" Watch "Sockets With Rmi" New topic
Author

Sockets With Rmi

Vrishal Likhite
Greenhorn

Joined: Nov 21, 2005
Posts: 18
i needed advice,
I have already combined Multicast sockets in a rmi prog but now i want to send the computer name which i have by InetAddress and receive the names all the computers on the multicast group.
can all the computers get the list of the computers on the multicast group.
This list should be ordered. i mean tat the list should have the same sequence on all the computers,

This all stuff is done in a rmi prog so its confusing me more
Should i stop using rmi and switch over to sockets only to make it easier???
Thanx
Tom Sullivan
Ranch Hand

Joined: Dec 20, 2005
Posts: 72
I am not sure that I completely understand your question but I will try to answer it as I think it is asked.

To get values back from the server, all you need to do is to declare the method in the interface, implement the method in the Imp class and call the method in your local implementation. So in your local code, you might say:

Interface names = (Interface) Naming.lookup(address);
ArrayList<String> computerNames = names.getNames(variable);

Then you need to build a server side Interface that declares this method.

Of course, then you need to implement the method on the server side. That might look something like:

Class RMIImp {

public ArrayList<String> getNames (String variable) {

ArrayList<String> computerNames = new ComputerNameFinderClass.getNames(variable);
computerNames.sort(); //if not done in the object that returns them.
return computerNames;
}
}

Not sure that I answered your question as it would seem like you know this if you are already working with the RMI classes. I would not opt for sockets as RMI manages the connection for you and you probably don't want to build all the objects that will take care of it without RMI.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sockets With Rmi