java.rmi.server.hostname and two network interfaces
Bartosz Bańkowski <[email protected]>
| Newsgroups | gmane.comp.java.sun.rmi |
|---|---|
| Message-ID | <[email protected]> |
I've got two servers:
- A with IP address 192.168.0.1
- B with two IPs: 192.168.1.1 and 1.0.0.1
A is the RMI client, B is the RMI server with object TestObj exported as Test.
1.0.0.1 is the public address. A can connect to B only through 192.168.1.1
address, because it has no Internet connection.
Client code (server A):
LocateRegistry registry = LocateRegistry.getRegistry("192.168.1.1", 1099);
TestObj test = (TestObj)registry.lookup("Test");
Server B has got hostname property set to "myhost.mydomain":
System.setProperty("java.rmi.server.hostname", "myhost.mydomain");
DNS for A and B shows that myhost.mydomain = 1.0.0.1.
When connecting from any host using the Internet address (1.0.0.1)
everything works
fine. After connection from server A to server B using address 192.168.1.1
server A is trying to connect to address 1.0.0.1, but since it has no Internet
connection it can't be done.
This problem can be resolved by changing DNS for server A, but the real-life
situation is much more complicated and it's not a good solution.
Is there any ability to set hostname or IP address to be returned depending on
source IP address/host?
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS". For general help, send email to
[email protected] and include in the body of the message "help".
For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html
To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html