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.