In RMI, I can only get return value by
InetSocketAddress address = new InetSocketAddress(hostname, port);
Server server = Stub.create(Server.class, address);
int return = server.getValue();
But, I can't get it by
public class Return {
int value;
}
InetSocketAddress address = new InetSocketAddress(hostname, port);
Server server = Stub.create(Server.class, address);
Return return = new Return();
server.getValue(return);
I know arguments will be serialized and deserialized, but that's not my question, my question is "why can't Java emulate a pass-by-reference as a pass by in-out, as was done in C with RPC?", I think it's related to java environment. By in-out I mean in C with RPC, you can get return value by
int return;
rpc.getValue(&return);
Hope now my question is clear.
getValue
methods on? RMI shouldn't require you to specifically get the return value as a separate step, you just call methods on the interface which return a result just as calling a method locally would. I'm afraid I don't really understand your question as it stands. – Bianca