Which Anti Virus
Saturday, 21 September 2013
Simple Demo Of RMI Registry Program
Posted on 20:18
by Unknown
Demointerface.java
/**
*
* @author Nish
*/
public interface DemoInterface extends java.rmi.Remote{
public String sayDemo() throws java.rmi.RemoteException;
}
Demosever.java
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.UnicastRemoteObject;
/**
*
* @author Nish
*/
public class DemoServer implements DemoInterface{
String message;
public DemoServer(){
super();
}
public DemoServer(String msg){
message = msg;
}
@Override
public String sayDemo() throws RemoteException {
return message;
}
public static void main(String []args){
try {
DemoInterface h = new DemoServer("Hello");
DemoInterface stub = (DemoInterface)UnicastRemoteObject.exportObject(h, 0);
java.rmi.registry.Registry reg = LocateRegistry.getRegistry();
reg.rebind("Hello", stub);
System.out.println("Server is ready for Operation");
}
catch (Exception ex) {}
}
}
Democlient.java
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
/**
*
* @author Nish
*/
public class DemoClient {
public static void main(String []args){
try{
Registry reg = LocateRegistry.getRegistry("localhost");
DemoInterface h = (DemoInterface)reg.lookup("Hello");
System.out.println(h.sayDemo());
}
catch(Exception e){}
}
}
Email This
BlogThis!
Share to X
Share to Facebook
Share to Pinterest
Posted in
java
|
No comments
Newer Post
Older Post
Home
0 comments:
Post a Comment
Subscribe to:
Post Comments (Atom)
Popular Posts
Categories
Android
Android Apps
apps
BlackBerry
Cprog
dfd
erd
Facebook
general
Hacking
HTC
ios
java
Mobile
nokia
Samsung
Srs
Window Apps
Windows 8
Blog Archive
▼
2013
(91)
►
November
(6)
►
October
(5)
▼
September
(17)
How to Get Maximum Battery Life in Laptop?
Android Secrete codes
How To recover Saved Password In Firefox ?
How To Install Android on PC or Laptop
Download Your Torrent Files Using IDM
How To Watch or Stream Torrents Without Downloading
How Can You Disable Your Desktop?
Simple Demo Of RMI Registry Program
Steps To Run RMI Program in JAVA
To Convert a FAT Partition to NTFS
Steps To Delete Viruses From your PenDrive
Get to Unblocked Websites Using Google! - Google a...
Steps To Find Manufacturing Date Of Your Computer
Password Vulnerability in All Browser
Lock Your Folder Without Any Software
Java Swing Look and Feel Feature-Example-Set Motif...
Make Analog Clock using java
►
August
(3)
►
July
(8)
►
June
(13)
►
May
(12)
►
April
(27)
Powered by
Blogger
.
About Me
Unknown
View my complete profile
0 comments:
Post a Comment