|
|
|
|
@ -42,7 +42,8 @@ public class HttpMatchBrowserHost extends Thread {
|
|
|
|
|
Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
|
|
|
|
|
boolean matches = false;
|
|
|
|
|
String ip = "";
|
|
|
|
|
Pattern ipPattern = Pattern.compile("192.168.1.*");
|
|
|
|
|
Pattern localIpPattern = Pattern.compile("192\\.168\\..*");
|
|
|
|
|
Pattern ipPattern = Pattern.compile("[0-9]{0,3}\\.[0-9]{0,3}\\.[0-9]{0,3}\\.[0-9]{0,3}");
|
|
|
|
|
while(e.hasMoreElements())
|
|
|
|
|
{
|
|
|
|
|
if (matches){
|
|
|
|
|
@ -54,10 +55,12 @@ public class HttpMatchBrowserHost extends Thread {
|
|
|
|
|
{
|
|
|
|
|
InetAddress i = ee.nextElement();
|
|
|
|
|
matches = ipPattern.matcher(i.getHostAddress()).matches();
|
|
|
|
|
System.out.println(i.getHostAddress());
|
|
|
|
|
if (matches){
|
|
|
|
|
ip = i.getHostAddress();
|
|
|
|
|
//System.out.println(ip);
|
|
|
|
|
break;
|
|
|
|
|
if (!localIpPattern.matcher(i.getHostAddress()).matches()) {
|
|
|
|
|
ip = i.getHostAddress();
|
|
|
|
|
//break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|