Fixed match client
This commit is contained in:
@@ -33,9 +33,9 @@ public class HttpMatchBrowserClient extends Thread {
|
|||||||
|
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
//e.printStackTrace();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
//e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ public class HttpMatchBrowserHost extends Thread {
|
|||||||
Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
|
Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
|
||||||
boolean matches = false;
|
boolean matches = false;
|
||||||
String ip = "";
|
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())
|
while(e.hasMoreElements())
|
||||||
{
|
{
|
||||||
if (matches){
|
if (matches){
|
||||||
@@ -54,10 +55,12 @@ public class HttpMatchBrowserHost extends Thread {
|
|||||||
{
|
{
|
||||||
InetAddress i = ee.nextElement();
|
InetAddress i = ee.nextElement();
|
||||||
matches = ipPattern.matcher(i.getHostAddress()).matches();
|
matches = ipPattern.matcher(i.getHostAddress()).matches();
|
||||||
|
System.out.println(i.getHostAddress());
|
||||||
if (matches){
|
if (matches){
|
||||||
ip = i.getHostAddress();
|
if (!localIpPattern.matcher(i.getHostAddress()).matches()) {
|
||||||
//System.out.println(ip);
|
ip = i.getHostAddress();
|
||||||
break;
|
//break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user