Skip to content
Snippets Groups Projects
Commit a202106a authored by brutzman's avatar brutzman
Browse files

infiniteReadLoop boolean to facilitate testing

parent 9037af8f
No related branches found
No related tags found
No related merge requests found
......@@ -11,11 +11,17 @@ import java.net.*;
*/
public class MulticastReceiver {
public static final String MULTICAST_ADDRESS = "239.1.2.15";
// reserved range for all IPv4 multicast: 224.0.0.0 through 239.255.255.255
// https://en.wikipedia.org/wiki/Multicast_address
// https://www.iana.org/assignments/multicast-addresses/multicast-addresses.xhtml
public static final String MULTICAST_ADDRESS = "239.1.2.15";
public static final int DESTINATION_PORT = 1718;
/** Time to live: how many router-decrement levels can be crossed */
public static final int TTL = 10;
final private static boolean infiniteReadLoop = true;
public static void main(String[] args)
{
try
......@@ -60,7 +66,8 @@ public class MulticastReceiver {
if (firstCharacters.equals("quit;"))
{
System.out.println("Received \"quit;\" sentinel");
break; // exit out of reading loop
if (!infiniteReadLoop)
break; // exit out of reading loop
}
int index = dis.readInt();
float firstFloat = dis.readFloat();
......
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