diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduReceiver.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduReceiver.java index 413b297f87a55e1acfa3c0010be3e2e440600850..c0b4b155767ffe3b4adf2dc1a476385ff77c5741 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduReceiver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduReceiver.java @@ -8,6 +8,14 @@ import edu.nps.moves.dis7.enumerations.*; import static edu.nps.moves.dis7.enumerations.DISPDUType.*; import edu.nps.moves.dis7.util.*; +/** + * Listens for packets sent to multicast address. Currently formatted to print entity + * location if an entity state PDU is received. + * + * @author jonathanboron + * @version 1.3 + */ + public class BoronPduReceiver { public static final int DEFAULT_MULTICAST_PORT = BoronPduSender.DEFAULT_MULTICAST_PORT; @@ -68,6 +76,7 @@ public class BoronPduReceiver message.append(")"); System.out.println(message.toString()); + //If PDU is an Entity State PDU, print location of entity if (currentPduType == ENTITY_STATE) { EntityStatePdu espdu = new EntityStatePdu(); diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduSender.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduSender.java index aaef02d78c61c836a1439537a6dcaff4a268072f..1de4085d0d241dfcca51cc082fd7334035a5619b 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduSender.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduSender.java @@ -8,12 +8,12 @@ import edu.nps.moves.dis7.*; import edu.nps.moves.dis7.enumerations.*; /** - * This is an example that sends many/most types of PDUs. Useful for testing standards - * compliance or getting a full set of PDUs. It also writes the generated PDUs to an XML file. - * Adapted from OpenDIS library example package edu.nps.moves.examples + * Takes a PDU and sends it to a multicast address. This program works in collaboration with separate + * PDU constructor classes. Current main method creates and sends Entity State PDUs to demonstrate + * functionality. * - * @author DMcG - * @version $Id:$ + * @author jonathanboron + * @version 1.3 */ public class BoronPduSender { @@ -133,7 +133,7 @@ public class BoronPduSender if (args.length == 2) { BoronPduSender sender = new BoronPduSender(Integer.parseInt(args[0]), args[1]); - for (int i = 0; i < generatedPdusList.size(); i++) + while (!generatedPdusList.isEmpty()) { Pdu aPdu = generatedPdusList.get(0); sender.run(aPdu); @@ -145,7 +145,7 @@ public class BoronPduSender System.out.println("Usage: AllPduSender <port> <multicast group>"); System.out.println("Default: AllPduSender " + DEFAULT_MULTICAST_PORT + " " + DEFAULT_MULTICAST_ADDRESS); BoronPduSender sender = new BoronPduSender(DEFAULT_MULTICAST_PORT, DEFAULT_MULTICAST_ADDRESS); - for (int i = 0; i < generatedPdusList.size(); i++) + while (!generatedPdusList.isEmpty()) { Pdu aPdu = generatedPdusList.get(0); sender.run(aPdu);