From 885fe1b7eb6287e792db1a1e1f43c17186325b27 Mon Sep 17 00:00:00 2001 From: terry-norbraten <tnorb@comcast.net> Date: Tue, 9 Jun 2020 19:52:11 -0700 Subject: [PATCH] notes update --- .../nps/moves/dis7/utilities/DisThreadedNetIF.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/edu/nps/moves/dis7/utilities/DisThreadedNetIF.java b/src/edu/nps/moves/dis7/utilities/DisThreadedNetIF.java index 777e8701eb..d056a315fe 100644 --- a/src/edu/nps/moves/dis7/utilities/DisThreadedNetIF.java +++ b/src/edu/nps/moves/dis7/utilities/DisThreadedNetIF.java @@ -78,7 +78,7 @@ public class DisThreadedNetIF private InetAddress maddr; private InetSocketAddress group; private NetworkInterface ni; - private MulticastSocket socket = null; + private DatagramSocket socket = null; /** * Default constructor using default port 3000 and multicast address 225.4.5.6 @@ -225,11 +225,13 @@ public class DisThreadedNetIF while (!killed) { // keep trying on error - // If something trips up with the socket, this thread will + // If something trips up with the socket, this thread will attempt to // re-establish for both send/receive threads try { + + // The initial value of the SO_BROADCAST socket option is FALSE socket = new MulticastSocket(disPort); - socket.joinGroup(group, ni); + ((MulticastSocket)socket).joinGroup(group, ni); while (!killed) { @@ -246,12 +248,12 @@ public class DisThreadedNetIF buffer.clear(); } } catch (IOException ex) { - System.err.println("Exception in DISThreadedNetIF receive thread: " + ex.getLocalizedMessage()); + System.err.println("Exception in DisThreadedNetIF receive thread: " + ex.getLocalizedMessage()); System.err.println("Retrying in 1 second"); } finally { if (socket != null && !socket.isClosed()) { try { - socket.leaveGroup(group, ni); + ((MulticastSocket)socket).leaveGroup(group, ni); } catch (IOException ex) { Logger.getLogger(DisThreadedNetIF.class.getName()).log(Level.SEVERE, null, ex); } @@ -285,7 +287,7 @@ public class DisThreadedNetIF baos.reset(); } } catch (Exception ex) { - System.err.println("Exception in DISThreadedNetIF send thread: " + ex.getLocalizedMessage()); + System.err.println("Exception in DisThreadedNetIF send thread: " + ex.getLocalizedMessage()); } } try { -- GitLab