Advanced Programming - CH-05-RPC - RMI
Advanced Programming - CH-05-RPC - RMI
Invocation
May 3, 2023
1 / 15
CH05: Topics to be covered
2 / 15
CH-05: RPC and RMI
what if we want to invoke programs from another machine connected with net ?
↓
• Remote Procedure Call (RPC)
• Remote Method Invocation (RMI)
↘
• are the mechanisms that enable a client to invoke the procedure or method
from the server
What is the Key difference b/n RPC and RMI
RPC 7→ only supports procedural programming
RMI 7→ supports object-oriented programming.
3 / 15
CH-05: RMI and RPC
5 / 15
CH-05: RMI and RPC
6 / 15
CH-05: RMI and RPC
7 / 15
CH-05: RMI and RPC
8 / 15
CH-05: RMI and RPC
9 / 15
CH-05: RMI and RPC
10 / 15
CH-05: RMI and RPC
11 / 15
CH-05: RMI and RPC
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
registry.bind("InterfaceName", stub);
}catch (Exception e) {
System.err.println("Server exception: " + e.toString());
e.printStackTrace();
}
}
12 / 15
CH-05: RMI and RPC
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
13 / 15
CH-05: RMI and RPC
14 / 15
Done!
Question!
15 / 15