Is anyone from the RMI team listening? This is a common problem and one frequently appearing on this interest group bulletin board. People keep hitting this wall over and over - mainly, I claim, because the problem has not been fixed. Setting java.rmi.server.hostname to the external Internet address of the server is an incomplete solution because it causes LAN-side RMI operations to fail.
I don't have the "perfect solution" in terms of working code but I think I can outline a basic requirement that would work well in most cases: RMI servers should be able to set a java.rmi.server.hostname property or functional equivalent based on the IP or Internet name of the client. For example: 1) internal traffic will have an intranet/LAN IP such as 192.168.0.X for those with cable routers or some set of Class-B/C addresses for more complex situations; 2) external traffic will have some other IP. Based on which case applies, the server should be able to return either the internal (LAN-side) address or external (Internet-side) address, respectively. This solution, which sounds like a fairly trivial addition to the RMI baseline, would work in most cases. Just give the software a hook for a map from client to server IP. The two cases I can think of for which this solution conceivably could fail are: (1) when a NIC (computer) would be used both internally and externally - for example, a laptop that might be used at various locations but with a fixed IP; (2) when there is no way to determine the map from client to server IP. Either case seems extremely unlikely with NAT scenarios - it would have to be a pretty wild NAT configuration. It seems to me that such a solution would also greatly simplify the solution in the case of multiple NICs/IPs on one server - map the incoming client and server IP combination to the returned server IP address. One registry could then service multiple Ethernet channels. Bottom line, it would be very helpful to have a full-blown RMI registry that really works. The above addition would be perhaps a few dozen lines of code and yet would greatly improve the registry's usability in today's networks. Jim Schatzman At 11:16 AM 2/24/2002 -0800, you wrote: >I am trying to export an object from a client that is using address translation >(NAT). When the server tries to talk to this client, he tries to access his virtual >IP (i.e. 192.168.x.x), not his real IP. > >I know you can set the java.rmi.server.hostname property on the server side to >correct this, but what do you do on the client side if it's running in an applet? > >I see that this bug says "closed, not a bug." > >http://developer.java.sun.com/developer/bugParade/bugs/4272092.html > >So, what is the fix/workaround? > >This is for a game I'm writing. Performance and functionality are great except >people can't play if they're using NAT (which is a lot of people). If this is >impossible to do in RMI, what should I use? Should I just port it all to raw >sockets (uggh..)? > >Thanks, >Blake > >__________________________________________________ >Do You Yahoo!? >Yahoo! Sports - Coverage of the 2002 Olympic Games >http://sports.yahoo.com > >=========================================================================== >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 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
