diff options
Diffstat (limited to 'tests/TestNet.java')
-rw-r--r-- | tests/TestNet.java | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/tests/TestNet.java b/tests/TestNet.java index e65684a..d1ff968 100644 --- a/tests/TestNet.java +++ b/tests/TestNet.java @@ -1,12 +1,25 @@ +/** + * Ivy software bus tester + * + * @author Yannick Jestin <jestin@cena.fr> + * + * (c) CENA 1998-2004 + * + * CHANGELOG + * + * 1.2.6 + * goes jakarta regexp + */ + import java.lang.Thread; import java.net.*; import java.io.*; import java.util.StringTokenizer; -import gnu.regexp.*; +import org.apache.regexp.*; import gnu.getopt.*; class TestNet implements Runnable { - private String domain; + private String mydomain; private boolean watcherrunning = false; private boolean isMulticastAddress = false; private Thread broadcastListener ; @@ -17,7 +30,7 @@ class TestNet implements Runnable { byte buf[] = new byte[256]; DatagramPacket packet=new DatagramPacket(buf, 256); int port; - String s = "Server waiting for Broadcast on "+domain; + String s = "Server waiting for Broadcast on "+mydomain; s+=(isMulticastAddress)?" (TCP multicast)":" (UDP broadcast)"; System.out.println(s); while( watcherrunning ) try { @@ -45,15 +58,9 @@ class TestNet implements Runnable { private static String getDomain(String net) { int sep_index = net.lastIndexOf( ":" ); if ( sep_index != -1 ) { net = net.substring(0,sep_index); } - try { - net += ".255.255.255"; - RE exp = new RE( "^(\\d+\\.\\d+\\.\\d+\\.\\d+).*"); - net = exp.substitute( net , "$1" ); - } catch ( REException e ){ - System.out.println("Bad broascat addr " + net); - return null; - } - //System.out.println("net: "+net); + net += ".255.255.255"; + RE exp = new RE( "^(\\d+\\.\\d+\\.\\d+\\.\\d+).*"); + net = exp.subst( net , "$1" ); return net; } @@ -94,7 +101,7 @@ class TestNet implements Runnable { void start(String domain) { String domainaddr=getDomain(domain); int port=getPort(domain); - this.domain=domainaddr+":"+port; + mydomain=domainaddr+":"+port; try { InetAddress group = InetAddress.getByName(domainaddr); if (group.isMulticastAddress()) { |