Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RMI

Status
Not open for further replies.

ahsan786

Technical User
Feb 4, 2004
12
HK
==================
CLIENT SIDE
==================
try
{
srvIntrface = (MyServerInterface) Naming.lookup("rmi://"+server+":1099/Interface");
}catch(Exception e){System.out.println("clientForm, lookup: Error getting the remote service");}
byte[] fileData = srvIntrface.getFile();
---------------------------------------------------------------------------------------------------------
This is how i connect to the interface on the client side... AND then get the file
server variable - is the ip of the remote machine
---------------------------------------------------------------------------------------------------------


==================
SERVER SIDE
==================
MyServer mySrvr = new MyServer();
Naming.rebind("//localhost:1099/Interface",mySrvr);
-------------------------------------------------------------------------------
this is how i bind the interface to the server
------------------------------------------------------------------------------


================
PROBLEM
================
i am working on a LAN.... when i run the above codes on one of the machines e.g. machine1.... the machine1 works fine and can get the file from machine 2. but when i run it on machine 2 and try to get the file from machine 1 following exception occurs
"
Connection refused to host: localhost; nested exception is: java.net.ConnectException: Connection refused: connect
"

Please help
 
you should start rmiregistry at the first

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top