Get outgoing IP address in Java RMI -
in java rmi application, can have instances behave servers both locally , on different hosts. in latter case, how can outgoing ip address can set argument of system property java.rmi.server.hostname?
right it's hard wired, that's not desirable solution.
you can use classic java way:
try { inetaddress addr = inetaddress.getlocalhost(); // ip address byte[] ipaddr = addr.getaddress(); // hostname string hostname = addr.gethostname(); } catch (unknownhostexception e) { }
Comments
Post a Comment