title: RMI : determine the IP address of a remote object
body: <p>I have functioning RMI client-server system. The server's host information is known to the clients so they can look it up and make calls. On first call to the server, the clients pass the server a remote reference of "themselves" so that the server can make callbacks. The server maintains a list of the all connected clients (when a client shuts down it "unregisters" from the server, and there is a thread that periodically checks if the clients are reachable and evicts the ones that are not).</p>
  
  <p>There is a graphical interface (part of a webapp) on the server that allows the users to visualize the clients that are connected at any time. Now I am asked to display the clients' IP address in this interface.</p>
  
  <p>My question : in RMI, if you have a remote reference of a remote object (a stub), is there a simple way to determine the host (DNS name or IP address) on which this remote object actually lives ?</p>
  
  <p>Note : I could use <code>RemoteServer.getClientHost</code> when the client first connects and store the info, or I could implement a remote method on the client that returns the host info, but I wish to know if there is a built-in RMI way of doing it with the remote reference.</p>