Skip to content
Snippets Groups Projects
Commit afe77990 authored by Brutzman, Don's avatar Brutzman, Don
Browse files

improved output

parent 642a9d25
No related branches found
No related tags found
No related merge requests found
...@@ -52,7 +52,8 @@ public class PduSender ...@@ -52,7 +52,8 @@ public class PduSender
// Loop through all the enumerated PDU types, create a PDU for each type, // Loop through all the enumerated PDU types, create a PDU for each type,
// and add that PDU to a list. // and add that PDU to a list.
for (DISPDUType pdu : DISPDUType.values()) { for (DISPDUType pdu : DISPDUType.values()) { // results are in alphabetic, not numeric order
Pdu aPdu = null; Pdu aPdu = null;
switch (pdu) { switch (pdu) {
...@@ -296,15 +297,19 @@ public class PduSender ...@@ -296,15 +297,19 @@ public class PduSender
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos); DataOutputStream dos = new DataOutputStream(baos);
byte[] buffer; byte[] buffer;
int pduCounter = 0;
for (Pdu pdu : generatedPdus) { for (Pdu pdu : generatedPdus) {
// Thread.sleep(300); // debug
pduCounter++;
pdu.marshal(dos); pdu.marshal(dos);
buffer = baos.toByteArray(); buffer = baos.toByteArray();
packet = new DatagramPacket(buffer, buffer.length, group); packet = new DatagramPacket(buffer, buffer.length, group);
socket.send(packet); socket.send(packet);
System.out.println("Sent PDU of type " + pdu.getClass().getSimpleName() + " ("+pdu.getPduType().getValue()+")");
System.out.println(pduCounter + ". Sent PDU of type " + pdu.getPduType().getValue() + " "+ pdu.getClass().getSimpleName());
baos.reset(); baos.reset();
} }
...@@ -325,9 +330,9 @@ public class PduSender ...@@ -325,9 +330,9 @@ public class PduSender
sender = new PduSender(Integer.parseInt(args[0]), args[1]); sender = new PduSender(Integer.parseInt(args[0]), args[1]);
} }
else { else {
System.out.println("Usage: PduSender <port> <multicast group>"); System.out.println("Usage: AlphabeticalPduSender <port> <multicast group>");
System.out.println("Default: PduSender " + DisThreadedNetIF.DEFAULT_DIS_PORT + " " + DisThreadedNetIF.DEFAULT_MCAST_GROUP); System.out.println("Default: AlphabeticalPduSender " + DisThreadedNetIF.DEFAULT_DIS_PORT + " " + DisThreadedNetIF.DEFAULT_MULTICAST_ADDRESS);
sender = new PduSender(DisThreadedNetIF.DEFAULT_DIS_PORT, DisThreadedNetIF.DEFAULT_MCAST_GROUP); sender = new PduSender(DisThreadedNetIF.DEFAULT_DIS_PORT, DisThreadedNetIF.DEFAULT_MULTICAST_ADDRESS);
} }
sender.run(); sender.run();
} }
......
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