Fixed match client
This commit is contained in:
@@ -33,9 +33,9 @@ public class HttpMatchBrowserClient extends Thread {
|
||||
|
||||
Thread.sleep(5000);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
//e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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){
|
||||
if (!localIpPattern.matcher(i.getHostAddress()).matches()) {
|
||||
ip = i.getHostAddress();
|
||||
//System.out.println(ip);
|
||||
break;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user