You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by "Dan Jemiolo (JIRA)" <ji...@apache.org> on 2006/11/03 20:14:17 UTC
[jira] Updated: (MUSE-91) Better handling of finding the right
local ip address
[ http://issues.apache.org/jira/browse/MUSE-91?page=all ]
Dan Jemiolo updated MUSE-91:
----------------------------
Fix Version/s: (was: 2.1.0)
not going to be able to figure this out for 2.1
> Better handling of finding the right local ip address
> -----------------------------------------------------
>
> Key: MUSE-91
> URL: http://issues.apache.org/jira/browse/MUSE-91
> Project: Muse
> Issue Type: Improvement
> Affects Versions: 2.0.0
> Reporter: Andrew Eberbach
> Assigned To: Dan Jemiolo
> Priority: Minor
>
> An interesting problem surfaced recently. If you want to figure out an EPR (for subscription, say) you'll need to get the ip address. However, InetAddress.getLocalHost().getHostAddress() can bind to a local interface and get either a loopback address or a 192.168.X.X address... this is bad. Here's some code to look for the first non-loopback and non-local address.
>
> String hostAddress = InetAddress.getLocalHost().getHostAddress();
> Enumeration interfaces = java.net.NetworkInterface.getNetworkInterfaces();
> while(interfaces.hasMoreElements()) {
> NetworkInterface nextInterface = (NetworkInterface) interfaces.nextElement();
> Enumeration addresses = nextInterface.getInetAddresses();
> while(addresses.hasMoreElements()) {
> InetAddress address = (InetAddress) addresses.nextElement();
> if(!address.isLoopbackAddress() && !address.isSiteLocalAddress()) {
> hostAddress = address.getHostAddress();
> break;
> }
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org