wood burning stoves 2.0*
The moose likes Distributed Java and the fly likes connecting to RMI server through a router, problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "connecting to RMI server through a router, problem." Watch "connecting to RMI server through a router, problem." New topic
Author

connecting to RMI server through a router, problem.

David Moran
Greenhorn

Joined: Jan 20, 2005
Posts: 2
I have an RMI server running on a local machine within a wireless network.

I bind this server to the RMI registry with this call,

Naming.rebind("//localhost/Compute", engine);

This binds the server to the local area network (the wireless router) via
the local IP address the router provides for this particular machine, which is 192.168.123.103.

Say, my WAN ip address (provided by the ISP) is 70.104.139.69. I set-up a virtual server in the router so that any calls to the WAN ip address on port 1099, will be directed to port 1099 of the local machine, ip= 192.168.123.103.

In my client I connect to the server with the following call,

compEngine = (Compute) Naming.lookup("rmi://70.104.139.69:1099/Compute");

It works great when the client is within the local network. However, when I try to connect outside of the local network, I have problems. It looks like the client finds the server and makes a connection. However, when I try to make a remote method call, I get the following exception:

java.rmi.ConnectException: Connection refused to host: 192.168.123.103; nested exception is:
java.net.ConnectException: Connection timed out: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
at sun.rmi.transport.tcp.TCPChannel.createConnection..............

I think there is a disconnect between the clients connection to 70.104.139.69 the (WAN IP) and the (LAN IP) 192.168.123.103.

I don't think it is my java.policy file, as I grant access to all, also, I have opened port 1099 in the firewall.

Has anybody experienced this? Thanks in advance, for your help.

-D
[ January 20, 2005: Message edited by: David Moran ]
morten wilken
Greenhorn

Joined: May 25, 2002
Posts: 13
hi,
we just went through a similar situation.

try to instruct both your client and server that you have a proxy in between.

use -Dhttp.propxtHost=IP_ADDR -Dhttp.proxyPort=PROXY_PORT on the server, and something similar on the client

hope it helps
sincerely
morten
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: connecting to RMI server through a router, problem.
 
Similar Threads
RMI * java.net.ConnectException * occurs when client on remote computer
Sending a message to a remote server
RMI problem with Localhost
RMI Server and Client behind two different routers
RMI app behind NAT firewall