From 8f976e6f59d8e1b52221e0dc2495275f361bc7d4 Mon Sep 17 00:00:00 2001 From: "Norbraten, Terry" <tdnorbra@nps.edu> Date: Thu, 4 Jun 2020 22:27:52 -0700 Subject: [PATCH] update to jdk 14 --- src/edu/nps/moves/dis7/examples/EspduSender.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/edu/nps/moves/dis7/examples/EspduSender.java b/src/edu/nps/moves/dis7/examples/EspduSender.java index 88d1e3de27..ef0ed2dd69 100644 --- a/src/edu/nps/moves/dis7/examples/EspduSender.java +++ b/src/edu/nps/moves/dis7/examples/EspduSender.java @@ -7,6 +7,7 @@ package edu.nps.moves.dis7.examples; import edu.nps.moves.dis7.*; import edu.nps.moves.dis7.utilities.CoordinateConversions; +import edu.nps.moves.dis7.utilities.DisThreadedNetIF; import java.io.*; import java.net.*; import java.util.*; @@ -65,14 +66,14 @@ public class EspduSender // Default settings. These are used if no system properties are set. // If system properties are passed in, these are over ridden. int port = DIS_DESTINATION_PORT; - NetworkMode mode = NetworkMode.BROADCAST; + NetworkMode mode; InetAddress destinationIp = null; // must be initialized, even if null try { destinationIp = InetAddress.getByName(DEFAULT_MULTICAST_GROUP); } catch (UnknownHostException e) { - System.out.println(e + " Cannot create multicast address"); + System.err.println(e + " Cannot create multicast address"); System.exit(0); } @@ -114,7 +115,8 @@ public class EspduSender throw new RuntimeException("Sending to multicast address, but destination address " + destinationIp.toString() + "is not multicast"); } - socket.joinGroup(destinationIp); + InetSocketAddress group = new InetSocketAddress(destinationIp, port); + socket.joinGroup(group, DisThreadedNetIF.findIp4Interface()); } } // end networkModeString } @@ -262,7 +264,7 @@ public class EspduSender } } catch (Exception ex) { - System.out.println(ex); + System.err.println(ex); } } -- GitLab