test/java/net/MulticastSocket/SetOutgoingIf.java
Print this page
*** 25,35 ****
* @test
* @bug 4742177
* @summary Re-test IPv6 (and specifically MulticastSocket) with latest Linux & USAGI code
*/
import java.net.*;
- import java.util.concurrent.*;
import java.util.*;
public class SetOutgoingIf {
private static int PORT = 9001;
--- 25,34 ----
*** 68,78 ****
// We need 2 or more network interfaces to run the test
//
List<NetworkInterface> nics = new ArrayList<NetworkInterface>();
for (NetworkInterface nic : Collections.list(NetworkInterface.getNetworkInterfaces())) {
! if (!nic.isLoopback())
nics.add(nic);
}
if (nics.size() <= 1) {
System.out.println("Need 2 or more network interfaces to run. Bye.");
return;
--- 67,78 ----
// We need 2 or more network interfaces to run the test
//
List<NetworkInterface> nics = new ArrayList<NetworkInterface>();
for (NetworkInterface nic : Collections.list(NetworkInterface.getNetworkInterfaces())) {
! // we should use only network interfaces with multicast support which are in "up" state
! if (!nic.isLoopback() && nic.supportsMulticast() && nic.isUp())
nics.add(nic);
}
if (nics.size() <= 1) {
System.out.println("Need 2 or more network interfaces to run. Bye.");
return;
*** 170,180 ****
for (;;) {
mcastsock.send(packet1);
mcastsock.send(packet2);
mcastsock.send(packet3);
! Thread.currentThread().sleep(1000); // sleep 1 second
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
--- 170,180 ----
for (;;) {
mcastsock.send(packet1);
mcastsock.send(packet2);
mcastsock.send(packet3);
! Thread.sleep(1000); // sleep 1 second
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}