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

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -