Results 1 to 17 of 17
- 11-27-2011, 06:03 AM #1
Member
- Join Date
- Aug 2011
- Posts
- 22
- Rep Power
- 0
How can client gain access to my RMI server remotely?
I am using my home PC as a server for my program. The server uses RMI to communicate back and forth with clients. I have been using a IP address that looks something like 30.30.30.300 (not exactly it, but it looks nice and round like that), this IP works for the RMI when the program is run locally. However when I attempt to run the client remotely using this address it obviously does not work. I tried using the address provided to me on What Is My IP Address - Shows Your IP Address, but that doesn't even work when I run the program locally.
Do I need to purchase a DNS server or something in order for the client to locate my server? Or is there a way for the client to access my server without that?
- 11-27-2011, 01:17 PM #2
Re: How can client gain access to my RMI server remotely?
Please explain. What URL does the client PC use?it obviously does not work
What error does the client see when it tries to connect?
Is your PC behind a firewall or router that could block access to your PC?
- 11-27-2011, 06:29 PM #3
Member
- Join Date
- Aug 2011
- Posts
- 22
- Rep Power
- 0
Re: How can client gain access to my RMI server remotely?
The server uses the following code to post a remote method:
Registry registry = LocateRegistry.createRegistry( 1099 );
Naming.rebind("UserLogin", stub);
The client then uses this code to access the remote method:
Registry registry = LocateRegistry.getRegistry("10.10.10.100");
UserLogin stub = (UserLogin)registry.lookup("UserLogin");
My computer's firewall is currently disabled and my modem and router have port 1099 open.
- 11-27-2011, 06:57 PM #4
Re: How can client gain access to my RMI server remotely?
Have you tried using simple ServerSocket / Socket client server programs to see if you can connect with a simpler program to validate that you can connect at all?
- 11-27-2011, 07:10 PM #5
Member
- Join Date
- Aug 2011
- Posts
- 22
- Rep Power
- 0
Re: How can client gain access to my RMI server remotely?
I have not tried this. However I can get the RMI to work for computers on my own network. ie: If I run the the program on my wife's desktop, it is able to access and communicate with the server on my computer.
What I am really unsure of is what address to use to access the server from outside the network. The 10.10.10.100 works within the network but does not work from outside of it. I tried using the IP address that I get from What Is My IP Address - Shows Your IP Address (ie: Naming.rebind("rmi://myIPaddress/UserLogin", stub);), but I get a "connection refused to host" error.
If I were to use a simple ServerSocket/Socket program for testing as you suggest... what address should I be looking to use?
- 11-27-2011, 07:17 PM #6
Re: How can client gain access to my RMI server remotely?
I'm not sure how you can find the IP address of your own computer when it's on a LAN behind a router.
My router has an interface that I can use to get statistics about the connections etc.
There are some sites I've visited that will tell you what your IP address. Try Google.
- 11-27-2011, 09:20 PM #7
Member
- Join Date
- Aug 2011
- Posts
- 22
- Rep Power
- 0
Re: How can client gain access to my RMI server remotely?
I think I have a DNS address that I would like to try and use, but how can I get my RMI to post to this address? It keeps defaulting to use my local IP. I read something about changing the property java.rmi.server.hostname however I don't know where and how to change it.
- 11-27-2011, 09:24 PM #8
Re: How can client gain access to my RMI server remotely?
Do you have an IP address the works with a simple client-server set of programs? You know your real IP address and can access it.
I don't know about using DNS
- 11-27-2011, 09:42 PM #9
Member
- Join Date
- Aug 2011
- Posts
- 22
- Rep Power
- 0
Re: How can client gain access to my RMI server remotely?
I used a sample socket program found at Java Socket Programming Example to test my real IP address.
In the Requester class I changed the line:
requestSocket = new Socket("localhost", 2004) to requestSocket = new Socket("myrealIP", 2004) //myrealIP = the IP address given to me at What Is My IP Address - Shows Your IP Address
When I run the server and the client, with myrealIP I get:
java.net.ConnectException: Connection refused: connect
at java.net.TwoStacksPlainSocketImpl.socketConnect(Na tive Method)....
But it runs fine when I leave it as "localhost".
- 11-27-2011, 09:44 PM #10
Re: How can client gain access to my RMI server remotely?
I think you need to resolve the connection problem you get with the simple client server programs before trying the RMI code.
- 11-28-2011, 12:16 AM #11
Member
- Join Date
- Aug 2011
- Posts
- 22
- Rep Power
- 0
Re: How can client gain access to my RMI server remotely?
Well the simple client server program works fine so long as I use a computer within my network. Once I leave the network, it won't work. Does it matter that I'm on Windows XP do I need Windows Server for RMI to work outside of the network?
- 11-28-2011, 12:21 AM #12
Re: How can client gain access to my RMI server remotely?
Is that where you want to use your RMI programs? Problem solved.so long as I use a computer within my network.
- 11-28-2011, 12:41 AM #13
Member
- Join Date
- Aug 2011
- Posts
- 22
- Rep Power
- 0
Re: How can client gain access to my RMI server remotely?
No, I intend to distribute the client program.
- 11-28-2011, 12:44 AM #14
Re: How can client gain access to my RMI server remotely?
If you can not access your PC with an IP address using the simple client-server, do you think using RMI will be easier?
It could be, I have not tried RMI from outside of a localhost environment.
- 11-28-2011, 12:57 AM #15
Member
- Join Date
- Aug 2011
- Posts
- 22
- Rep Power
- 0
Similar Threads
-
remotely access video stream from camera
By adityapr in forum NetworkingReplies: 1Last Post: 05-03-2011, 10:07 PM -
server-client; client sends a username to the server.
By lkcz in forum New To JavaReplies: 2Last Post: 09-24-2010, 11:31 AM -
how to access Ms Access from client side to server side
By arunkumarinfo in forum JDBCReplies: 1Last Post: 03-20-2010, 07:03 PM -
Datagram Client and Server, client timer question
By saru88 in forum NetworkingReplies: 1Last Post: 10-05-2008, 03:12 PM -
Identify Client in Socket Client Server Application
By masadjie in forum NetworkingReplies: 1Last Post: 12-20-2007, 09:18 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks