Lesson 3: Remote Method Invocation (RMI) Mixing RMI and Sockets
Lesson 3: Remote Method Invocation (RMI) Mixing RMI and Sockets
Lesson 3: Remote Method Invocation (RMI) Mixing RMI and Sockets
JNI makes this distinction a little less rigid since it allows Java to
interact with other languages
Socket flow of events -- synchronous
Client Server
•Get user input •Await client message
•Decode user input •…
•Create server message •…
•Send message to server •Receive client message
•Await server response •Decode client message
•… •Perform action
•… •Create client message
•… •Send to client
•Receive server message
•Decode reply Method call on standalone object
•Send output to user
Socket flow - asynchronous
Client1 Server Client2
•User input (UI) •Wait •User input (UI)
•Decode UI •… •Decode UI
•Create srvr msg •… •Create srvr msg
•Send srvr msg •Receive client msg •Send srvr msg
•Await srvr reply •Decode client msg •Await srvr reply
•… •Perform action •…
•… •Create client message •…
•… •Send to client1 •…
•Receive server •Send to client2 •Receive server
message message
•Decode reply •Decode reply
•Output to user •Output to user
RMI flow of events -- synchronous
Client Server
•Instantiate object(s)
•Bind to registry
•Get/cache remote obj ref •…
•Get user input •…
•Decode user input •…
•Remote method call •…
•Decode return value
•Send output to user
RMI Cartoon1
RMI Cartoon2
Steps for RMI Application
Implement both client and server on single
machine to test