Changeset 7800 in josm for trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControl.java
- Timestamp:
- 2014-12-12T20:08:22+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControl.java
r7702 r7800 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.io.remotecontrol; 3 4 import java.net.InetAddress; 5 import java.net.UnknownHostException; 3 6 4 7 import org.openstreetmap.josm.Main; … … 34 37 static final int protocolMajorVersion = 1; 35 38 static final int protocolMinorVersion = 7; 39 40 private static final String LOCALHOST = "localhost"; 36 41 37 42 /** … … 71 76 return Main.pref.getPreferencesDir() + "remotecontrol/"; 72 77 } 78 79 /** 80 * Returns the inet address used for remote control. 81 * @return the inet address used for remote control 82 * @throws UnknownHostException if the local host name could not be resolved into an address. 83 * @since 7800 84 */ 85 public static InetAddress getInetAddress() throws UnknownHostException { 86 String hostname = Main.pref.get("remote.control.host", LOCALHOST); 87 InetAddress result = InetAddress.getByName(hostname); 88 // Sometimes localhost resolution does not work as expected, see #10833 89 if (LOCALHOST.equalsIgnoreCase(hostname) && !LOCALHOST.equalsIgnoreCase(result.getHostName())) { 90 InetAddress localhostAddr = InetAddress.getLocalHost(); 91 // Use this result if it's better. Not sure if it's a Java bug or not 92 if (LOCALHOST.equalsIgnoreCase(localhostAddr.getHostName())) { 93 result = localhostAddr; 94 } 95 } 96 return result; 97 } 73 98 }
Note:
See TracChangeset
for help on using the changeset viewer.
