|
|
@ -466,10 +466,15 @@ public final class serverCore extends serverAbstractThread implements serverThre
|
|
|
|
|
|
|
|
|
|
|
|
public static InetAddress publicLocalIP() {
|
|
|
|
public static InetAddress publicLocalIP() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
String hostName;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
hostName = InetAddress.getLocalHost().getHostName();
|
|
|
|
|
|
|
|
} catch (java.net.UnknownHostException e) {
|
|
|
|
|
|
|
|
hostName = "localhost"; // hopin' nothing serious happened only the hostname changed while running yacy
|
|
|
|
|
|
|
|
System.err.println("ERROR: (internal) " + e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
// list all addresses
|
|
|
|
// list all addresses
|
|
|
|
//InetAddress[] ia = InetAddress.getAllByName("localhost");
|
|
|
|
InetAddress[] ia = InetAddress.getAllByName(hostName);
|
|
|
|
InetAddress[] ia = InetAddress.getAllByName(InetAddress.getLocalHost().getHostName());
|
|
|
|
|
|
|
|
//for (int i = 0; i < ia.length; i++) System.out.println("IP: " + ia[i].getHostAddress()); // DEBUG
|
|
|
|
//for (int i = 0; i < ia.length; i++) System.out.println("IP: " + ia[i].getHostAddress()); // DEBUG
|
|
|
|
if (ia.length == 0) {
|
|
|
|
if (ia.length == 0) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|