Skip to content
Snippets Groups Projects
Commit 885fe1b7 authored by terry-norbraten's avatar terry-norbraten
Browse files

notes update

parent ca69d174
No related branches found
No related tags found
No related merge requests found
...@@ -78,7 +78,7 @@ public class DisThreadedNetIF ...@@ -78,7 +78,7 @@ public class DisThreadedNetIF
private InetAddress maddr; private InetAddress maddr;
private InetSocketAddress group; private InetSocketAddress group;
private NetworkInterface ni; private NetworkInterface ni;
private MulticastSocket socket = null; private DatagramSocket socket = null;
/** /**
* Default constructor using default port 3000 and multicast address 225.4.5.6 * Default constructor using default port 3000 and multicast address 225.4.5.6
...@@ -225,11 +225,13 @@ public class DisThreadedNetIF ...@@ -225,11 +225,13 @@ public class DisThreadedNetIF
while (!killed) { // keep trying on error 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 // re-establish for both send/receive threads
try { try {
// The initial value of the SO_BROADCAST socket option is FALSE
socket = new MulticastSocket(disPort); socket = new MulticastSocket(disPort);
socket.joinGroup(group, ni); ((MulticastSocket)socket).joinGroup(group, ni);
while (!killed) { while (!killed) {
...@@ -246,12 +248,12 @@ public class DisThreadedNetIF ...@@ -246,12 +248,12 @@ public class DisThreadedNetIF
buffer.clear(); buffer.clear();
} }
} catch (IOException ex) { } 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"); System.err.println("Retrying in 1 second");
} finally { } finally {
if (socket != null && !socket.isClosed()) { if (socket != null && !socket.isClosed()) {
try { try {
socket.leaveGroup(group, ni); ((MulticastSocket)socket).leaveGroup(group, ni);
} catch (IOException ex) { } catch (IOException ex) {
Logger.getLogger(DisThreadedNetIF.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(DisThreadedNetIF.class.getName()).log(Level.SEVERE, null, ex);
} }
...@@ -285,7 +287,7 @@ public class DisThreadedNetIF ...@@ -285,7 +287,7 @@ public class DisThreadedNetIF
baos.reset(); baos.reset();
} }
} catch (Exception ex) { } catch (Exception ex) {
System.err.println("Exception in DISThreadedNetIF send thread: " + ex.getLocalizedMessage()); System.err.println("Exception in DisThreadedNetIF send thread: " + ex.getLocalizedMessage());
} }
} }
try { try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment