logo
  • Home
  • About
  • Contact
  • My Forum
  • Privacy Policy
  • General
  • Technical
"My country owes me nothing. It gave me, as it gives every boy and girl, a chance. It gave me schooling, independence of action, opportunity for service and honor. In no other land could a boy from a country village, without inheritance or influential friends, look forward with unbounded hope." -Herbert Hoover
delete
bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

RMI program

Posted by admin in Technical on 10 5th, 2009 | no responses

//code for remote Interface

import java.rmi.*;
public interface HelloInterface extends Remote
{
public String getMessage() throws RemoteException;
public void display() throws RemoteException;
}

//Code for Server

import java.rmi.*;
import java.rmi.server.*;
public class HelloServer extends UnicastRemoteObject implements HelloInterface
{
public HelloServer() throws RemoteException
{
}
public String getMessage() throws RemoteException
{
return”Hello Sir”;
}
public void display() throws RemoteException
{
System.out.println(”hi how r u”);
}
public static void main(String args[])
{
try
{
HelloServer Server=new HelloServer();
Naming.rebind(”rmi://localhost:1099/Server”,Server);
}
catch(Exception e)
{
}
}
}

// Code for Client

import java.rmi.*;
public class HelloClient
{
public static void main(String args[])
{
try
{
HelloInterface Server=(prgm7)Naming.lookup(”rmi://localhost:1099/Server”);
String msg=Server.getMessage();
System.out.println(msg);
Server.display();
}
catch(Exception e)
{
}
}
}


//Execution Method

OUTPUT :

>javac HelloInterface.java

>javac HelloServer.java

>javac HelloClient.java

>rmic HelloServer

>start rmiregistry // Opens a New Window

>java HelloServer // Run in the New Window

>java HelloClient // Run in New Window
Hello Sir

Server Window Output
————————-
hi how r u

Leave a Reply

Click here to cancel reply.

  • Sponsors
  • Recent Posts
  • Recent Comments
  • About
  • some concepts related with operating system
  • Friend
  • pani puri in rainy days
  • Client/Server Program
  • RMI program
  • Hello world!
  • Mr chandan Hi, this is a test comment....
About us
  • Blog Roll
  • archives

Blogroll

  • Drink Recipes
  • Food Recipes
  • Free SMS India
  • Indian Blogs
  • Jokes Blog
  • Kannada Portal
  • Kannada Songs
  • October 2009

categories

  • General
  • Technical

Search

  • Sponsors
  • Admin
advertisement advertisement
  • Log in
© Shwetha's Blog 2009 | chandan | kannada | directory | Indian Blogs | Powered by Wordpress | Elegant Themes