title: RMI Connect from local and remote
body: <p>I am trying to setup RMI in a way where I can connect from both the local machine that has a binded object and a remote machine. It seems like it can only be remote or local, at least from all the things I've tried.</p>
  <pre><code>        System.setProperty(&quot;java.rmi.server.hostname&quot;, &quot;public IP&quot;);
  
          try {
              Registry registry = LocateRegistry.createRegistry(Registry.REGISTRY_PORT,
                      new SslRMIClientSocketFactory(),
                      new SslRMIServerSocketFactory());
  
              registry.rebind(&quot;world_server&quot;, World.getWorld());
  
          } catch(Exception e) {
              e.printStackTrace();
          }
  </code></pre>
  <p>Using public IP, the local machine can't connect. If I change &quot;public IP&quot; to 127.0.0.1, remote machines can no longer connect. It will throw an error saying &quot;connection refused on 127.0.0.1&quot;.</p>
  <p>Is there any way to set this up so that both the local machine and remote can connect?</p>
  <p>Thanks</p>
  <p>Edit: Nevermind, fixed the issue.</p>