Underground - Bhasker V K,the Sandman's Hideout

Thanks for dropping in...I got this running since i needed a place to post info that i found interesting which,i could access online .lotta stuff here might find a few glances ...so make ur self @ home...and hope u find the links/info ur looking for or atleast giv u a hint 'what you should ' be looking for .
Keep Clicking,
Bhasker V K
VoyForums
VoyForums has a no-popup policy. If you think you are receiving a pop-up originating from a VoyForum,
please report the Forum ID and any ad info using this contact form.

VoyUser Login optional ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 1 ]
Subject: java rmi code


Author:
b
[ Next Thread | Previous Thread | Next Message | Previous Message ]
Date Posted: 10:38:06 04/03/05 Sun
Author Host/IP: NoHost/61.2.38.134

uhello.java

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

//**********************************************************************************
uhelloclient.java

import java.rmi.*;
import java.io.*;
public class uhelloclient
{
public static void main(String s[])
{
uhello client;
DataInputStream dis = new DataInputStream(System.in);
String str=" ";
String str1;
try
{
client=(uhello)Naming.lookup("rmi://127.0.0.1/hai");
System.out.println("This program reads a message from server,then checks it with what the user types");
str1=dis.readLine();
str=client.getMessage();
if(str.equals(str1))
{
System.out.println("Both are same");
}
else
{
System.out.println("Both are not same");
}
}
catch(Exception e)
{
System.out.println(e);
}
System.out.println("message from server"+str);
}
}
//************************************************************************************
uhelloserver.java

import java.rmi.*;
import java.rmi.server.*;
public class uhelloserver extends UnicastRemoteObject implements uhello
{
String str=" ";
public uhelloserver(String str1)throws RemoteException
{
str=str1;
}
public String getMessage()
{
return str;
}
public static void main(String args[])
{
try
{
uhelloserver u=new uhelloserver("hello");
Naming.rebind("rmi://127.0.0.1/hai",u);
System.out.println("Server is listening");
}
catch(Exception e)
{
System.out.println(e);
}
}
}

***************************
javac interface then the server ,then client ,then type rmiregistry. then in a new cmd java server,anotha window java client ..voila

[ Next Thread | Previous Thread | Next Message | Previous Message ]


VoyUser Login ] Not required to post.
Post a public reply to this message | Go post a new public message
* Notice: Posting problems? [ Click here ]
* HTML allowed in marked fields.
Message subject (required):

Name (required):

  Expression (Optional mood/title along with your name) Examples: (happy, sad, The Joyful, etc.) help)

  E-mail address (optional):

* Type your message here:

Choose Message Icon: [ View Emoticons ]

Notice: Copies of your message may remain on this and other systems on internet. Please be respectful.

[ Contact Forum Admin ]

"
"
Forum timezone: GMT-8
VF Version: 2.94, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2008 Voyager Info-Systems. All Rights Reserved.
if u want to post ,send an email to bosky101@indiatimes.com ..this is to maintain the integrity of this forum ..cheers
Keep Clicking,
bosky101 Click here to listen to my music station