Reputation: 109
I'm just starting to learn Java's RMI, and believe I understand the process, client sends method requests and params, server does computation and sends return result back.
However does the server perform everything within the method locally?
Specifically, if a file is read in the method, am I correct in thinking this is performed by the server?
If this is the case is there any way for the method to specifically access resources from the client (such as the client's System.out?)
Upvotes: 1
Views: 1580
Reputation: 53694
You can use rmiio to easily stream data over rmi. that said i highly doubt you would want to do that with System.out.
Upvotes: 1
Reputation: 31
If I understand your question, I say yes, your'e correct. By definition the (remote)method runs on the server side. The client just holds a fake object (proxy or stub) that makes the connection to the server, passes the arguments and gets the return value for you.
Think about the client and server running in different machines, there's no way to server knows anything about the client's resources, unless the client acts itself as a server.
Regards
Upvotes: 1
Reputation: 49744
Serializable
, and streams typically aren't.Having said that, a client can also act as a server, exporting its own remote objects, which can be passed to the (other) server, which can then use that remote object to call the client back.
Upvotes: 2