• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sockets With Rmi

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
This tiny ad is wafer thin:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic