In this example you will see function calls from client to server and vice versa. This application for running requires a Remote Machine.
For running this application lets assume there are two machine one with 192.168.10.97 and other 192.168.10.113.
Here machine having IP address 192.168.10.113 is a server and machine having IP address 192.168.10.97 is a client. So we divide the programs in two categories one for server and other for client.
Well in this application there are seven java files. List of java files and their code are shown below:
RemoteInterface.java
import java.rmi.*;
|
RemoteInterface1.java
import java.rmi.*;
|
ServerImplements.java
import java.rmi.*;
|
ServerImplements2.java
import java.rmi.*;
|
Server.java
import java.rmi.*;
|
Server2.java
import java.rmi.*;
|
client.java
import java.rmi.*;
|
Steps for execution at Server machine:
javac RemoteInterface.java
javac RemoteInterface1.java
javac ServerImplements.java
javac ServerImplements2.java
rmic ServerImplements
rmic ServerImplements2
javac Servet2.java
start rmiregistry
java server2
Steps for execution at Client machine:
javac RemoteInterface.java
javac RemoteInterface1.java
javac ServerImplements.java
javac ServerImplements2.java
rmic ServerImplements
rmic ServerImplements2
javac Server.java
start rmiregistry
start java server
javac Client.java
java Client
Output will be shown at client machine
Add:5
Sub:2
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: RMI-Example-3
Post your Comment