AddServerIntf.java
import java.rmi.*;
public interface AddServerIntf extends Remote{
int fact(int d1)throws RemoteException;
}
AddServerImpl.java
import java.rmi.*;
import java.rmi.server.*;
public class AddServerImpl extends UnicastRemoteObject implements AddServerIntf{
public AddServerImpl()throws RemoteException{}
public int fact(int d1)throws RemoteException{
int i,d=1;
for(i=d1;i>1;i--){
d=d*i;
}
return d;
}
}
AddServer.java
import java.net.*;
import java.rmi.*;
public class AddServer{
public static void main(String args[]){
try{
AddServerImpl addServerImpl=new AddServerImpl();
Naming.rebind("AddServer",addServerImpl);
}
catch(Exception e){
System.out.println("Exception: "+e);
}
}
}
AddClient.java
import java.rmi.*;
public class AddClient{
public static void main(String args[]){
try{
String addServerURL="rmi://"+args[0]+"/AddServer";
AddServerIntf addServerIntf=(AddServerIntf)Naming.lookup(addServerURL);
System.out.println("Number is : "+args[1]);
int d1=Integer.valueOf(args[1]).intValue();
System.out.println("The Factorial is : "+addServerIntf.fact(d1));
}
catch(Exception e){
System.out.println("Exception : "+e);
}
}
}
import java.rmi.*;
public interface AddServerIntf extends Remote{
int fact(int d1)throws RemoteException;
}
AddServerImpl.java
import java.rmi.*;
import java.rmi.server.*;
public class AddServerImpl extends UnicastRemoteObject implements AddServerIntf{
public AddServerImpl()throws RemoteException{}
public int fact(int d1)throws RemoteException{
int i,d=1;
for(i=d1;i>1;i--){
d=d*i;
}
return d;
}
}
AddServer.java
import java.net.*;
import java.rmi.*;
public class AddServer{
public static void main(String args[]){
try{
AddServerImpl addServerImpl=new AddServerImpl();
Naming.rebind("AddServer",addServerImpl);
}
catch(Exception e){
System.out.println("Exception: "+e);
}
}
}
AddClient.java
import java.rmi.*;
public class AddClient{
public static void main(String args[]){
try{
String addServerURL="rmi://"+args[0]+"/AddServer";
AddServerIntf addServerIntf=(AddServerIntf)Naming.lookup(addServerURL);
System.out.println("Number is : "+args[1]);
int d1=Integer.valueOf(args[1]).intValue();
System.out.println("The Factorial is : "+addServerIntf.fact(d1));
}
catch(Exception e){
System.out.println("Exception : "+e);
}
}
}
factorial of a number visit this http://www.123arena.com/2012/09/java-program-for-factorial-of-given.html
ReplyDeleteHow to run this code?
ReplyDeleteI appreciate your efforts because it conveys the message of what you are trying to say. It's a great skill to make even the person who doesn't know about the subject could able to understand the subject . Your blogs are understandable and also elaborately described. I hope to read more and more interesting articles from your blog. All the best.
ReplyDeleterpa training in bangalore
best rpa training in bangalore
RPA training in bangalore
rpa course in bangalore
rpa training in chennai
rpa online training
Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
ReplyDeleteAWS training in chennai
AWS Training in Bangalore
Thanks for sharing The Information The Information shared is very valuable Please keep Updating us Time Just went on redaing the article Python Online Training AWS Online Training Devops Online Training Data Science Online Training
ReplyDeleteHi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging
ReplyDeleteaws training in chennai | aws training in annanagar | aws training in omr | aws training in porur | aws training in tambaram | aws training in velachery
Resources like the one you mentioned here will be very useful to me ! I will post a link to this page on my blog. I am sure my visitors will find that very useful.
ReplyDeleteAws Training in Chennai
Aws Training in Velachery
Aws Training in Tambaram
Aws Training in Porur
Aws Training in Omr
Aws Training in Annanagar
This post is so interactive and informative.keep update more information...
ReplyDeleteJava Training in Tambaram
java course in tambaram
ReplyDeleteWonderful blog.Thanks for sharing such a worthy information...
Python Training in Hyderabad
Python Classes in Gurgaon
Nice Post!!! gratitude for imparting this post to us.
ReplyDeleteAndroid Development Course in Chennai
Android Online Course
Android Training Institutes in Bangalore