This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixnetwork: Incorrect server IP address when starting PMS by launchin…

…g PMS.exe or PMS.bat

Continuation of commit 9dffdac.
  • Loading branch information...
Raptor399 committed May 21, 2013
1 parent 3bade87 commit d7a306cb7c491a907446a7ca29eb8cbf4a012f79
Showing with 6 additions and 5 deletions.
  1. +6 −5 src/main/java/net/pms/network/NetworkConfiguration.java
@@ -165,12 +165,13 @@ private NetworkConfiguration(Enumeration<NetworkInterface> networkInterfaces) {
Set<InetAddress> addrSet = new HashSet<InetAddress>();
LOGGER.trace("available addresses for {} is: {}", networkInterface.getName(), Collections.list(networkInterface.getInetAddresses()));
- for (InterfaceAddress ia : networkInterface.getInterfaceAddresses()) {
- if (ia != null) {
- InetAddress address = ia.getAddress();
-
+ // networkInterface.getInterfaceAddresses() returns 'null' on some adapters if
+ // the parameter 'java.net.preferIPv4Stack=true' is passed to the JVM
+ // Use networkInterface.getInetAddresses() instead
+ for (InetAddress address : Collections.list(networkInterface.getInetAddresses())) {
+ if (address != null) {
if (isRelevantAddress(address)) {
- addrSet.add(ia.getAddress());
+ addrSet.add(address);
}
}
}

0 comments on commit d7a306c

Please sign in to comment.