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
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ 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 ]


Post a message:
This forum requires an account to post.
[ Create Account ]
[ Login ]
[ Contact Forum Admin ]

"
"
Forum timezone: GMT-8
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 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