From eaf75a1877dce7778ce291036564238a13f150a9 Mon Sep 17 00:00:00 2001 From: brutzman <brutzman@nps.edu> Date: Sat, 17 Jul 2021 17:23:48 -0700 Subject: [PATCH] debugged sender problem related to prior socket buffer not getting dropped --- .../src/OpenDis7Examples/AllPduReceiver.java | 48 +++-- .../OpenDis7Examples/AllPduReceiverLog.txt | 180 +++++++++-------- .../src/OpenDis7Examples/AllPduSender.java | 14 +- .../src/OpenDis7Examples/AllPduSenderLog.txt | 188 +++++++++--------- .../src/OpenDis7Examples/EspduSender.java | 14 +- .../src/OpenDis7Examples/EspduTerminalLog.txt | 124 +++++++----- 6 files changed, 306 insertions(+), 262 deletions(-) diff --git a/examples/src/OpenDis7Examples/AllPduReceiver.java b/examples/src/OpenDis7Examples/AllPduReceiver.java index 20b443df78..06c745a247 100644 --- a/examples/src/OpenDis7Examples/AllPduReceiver.java +++ b/examples/src/OpenDis7Examples/AllPduReceiver.java @@ -7,6 +7,7 @@ import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; import edu.nps.moves.dis7.utilities.PduFactory; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; /** Listen to all kinds of PDUs and report them */ @@ -28,9 +29,8 @@ public class AllPduReceiver */ public static void main(String args[]) { - MulticastSocket socket; - DatagramPacket packet; - InetAddress address; + MulticastSocket multicastSocket; + InetAddress internetAddress; PduFactory pduFactory = new PduFactory(); System.out.println(TRACE_PREFIX + "started..."); @@ -38,33 +38,38 @@ public class AllPduReceiver try { if (args.length == 2) { - address = InetAddress.getByName(args[0]); - socket = new MulticastSocket(Integer.parseInt(args[1])); + internetAddress = InetAddress.getByName(args[0]); + multicastSocket = new MulticastSocket(Integer.parseInt(args[1])); } else { System.out.println("Usage: AllPduReceiver <multicast group> <port>"); System.out.println("Default: AllPduReceiver " + DEFAULT_MULTICAST_ADDRESS + " " + DEFAULT_MULTICAST_PORT); - socket = new MulticastSocket(DEFAULT_MULTICAST_PORT); - address = InetAddress.getByName(DEFAULT_MULTICAST_ADDRESS); + multicastSocket = new MulticastSocket(DEFAULT_MULTICAST_PORT); + internetAddress = InetAddress.getByName(DEFAULT_MULTICAST_ADDRESS); } System.out.println("To quit: stop or kill this process"); - socket.joinGroup(address); + multicastSocket.joinGroup(internetAddress); + byte buffer[] = new byte[1500]; // typical MTU size in bytes + while (true) // Loop infinitely, receiving datagrams { - byte buffer[] = new byte[1500]; // typical MTU size in bytes - packet = new DatagramPacket(buffer, buffer.length); // reset packet each time - - socket.receive(packet); // process blocks here until receipt of network packet with PDU + Arrays.fill(buffer, (byte)0); + DatagramPacket datagramPacket = new DatagramPacket(buffer, buffer.length); // reset packet each time + multicastSocket.receive(datagramPacket); // process blocks here until receipt of network packet with PDU +// datagramPacket.setLength(buffer.length); // Pdu pdu = pduFactory.createPdu(packet.getData()); // packet.getData() returns byte[] array data buffer - List<Pdu> pduBundle = pduFactory.getPdusFromBundle(packet.getData(),packet.getLength()); - if (pduBundle.size() > 1) - System.out.println("Received PDU bundle size is " + pduBundle.size()); - else if (pduBundle.isEmpty()) - System.out.println("Received PDU bundle is empty, packet.getData().length=" + packet.getData().length + ", error..."); + List<Pdu> pduBundle = pduFactory.getPdusFromBundle(datagramPacket.getData(),datagramPacket.getLength()); + + if (pduBundle.isEmpty()) + System.out.println("Received PDU bundle is empty, packet.getData().length=" + datagramPacket.getData().length + ", error..."); +// else if (pduBundle.size() == 1)// common case, typically unremarkable +// System.out.println("Received PDU bundle size is " + pduBundle.size()); + else if (pduBundle.size() > 1) + System.out.println("Received PDU bundle size is " + pduBundle.size()); for (Pdu nextPdu : pduBundle) // iterator loop through PDU bundle { @@ -75,11 +80,9 @@ public class AllPduReceiver StringBuilder message = new StringBuilder(); message.append(DisTime.timeStampToString(nextPdu.getTimestamp())).append(" "); - message.append("received DIS PDU "); - String currentPduTypePadded = String.format("%-34s", currentPduType); // - indicates right padding of whitespace - message.append(" " ).append(currentPduTypePadded); - if (currentPduType.getValue() < 10) - message.append(" "); // column spacing + message.append("received new DIS PDU "); + String currentPduTypePadded = String.format("%-48s", currentPduType); // - indicates right padding of whitespace + message.append(currentPduTypePadded); // optional, verbose // String currentPduTypeNamePadded = String.format("%-49s", currentPduTypeName); // - indicates right padding of whitespace // message.append(" of type ").append(currentPduTypeNamePadded); // package.class name @@ -104,6 +107,7 @@ public class AllPduReceiver System.out.println(); } } + pduBundle.clear(); } } catch (IOException e) { diff --git a/examples/src/OpenDis7Examples/AllPduReceiverLog.txt b/examples/src/OpenDis7Examples/AllPduReceiverLog.txt index f4b8b485d8..77489f159d 100644 --- a/examples/src/OpenDis7Examples/AllPduReceiverLog.txt +++ b/examples/src/OpenDis7Examples/AllPduReceiverLog.txt @@ -1,85 +1,95 @@ -Invocation instructions: -1. run or debug AllPduReceiver.java -2. send PDUs from another program such as AllPduSender.java (shown here) -3. kill process console when complete. - -Program response: - -=================================================== - -DisExamplesOpenDis7.AllPduReceiver started... -Usage: AllPduReceiver <port> <multicast group> -Default: AllPduReceiver 3000 239.1.2.3 -received DIS PDU 1 ENTITY_STATE of type edu.nps.moves.dis7.EntityStatePdu (protocolFamily ENTITY_INFORMATION_INTERACTION) -received DIS PDU 2 FIRE of type edu.nps.moves.dis7.FirePdu (protocolFamily WARFARE) -received DIS PDU 3 DETONATION of type edu.nps.moves.dis7.DetonationPdu (protocolFamily WARFARE) -received DIS PDU 4 COLLISION of type edu.nps.moves.dis7.CollisionPdu (protocolFamily ENTITY_INFORMATION_INTERACTION) -received DIS PDU 5 SERVICE_REQUEST of type edu.nps.moves.dis7.ServiceRequestPdu (protocolFamily LOGISTICS) -received DIS PDU 6 RESUPPLY_OFFER of type edu.nps.moves.dis7.ResupplyOfferPdu (protocolFamily LOGISTICS) -received DIS PDU 7 RESUPPLY_RECEIVED of type edu.nps.moves.dis7.ResupplyReceivedPdu (protocolFamily LOGISTICS) -received DIS PDU 8 RESUPPLY_CANCEL of type edu.nps.moves.dis7.ResupplyCancelPdu (protocolFamily LOGISTICS) -received DIS PDU 9 REPAIR_COMPLETE of type edu.nps.moves.dis7.RepairCompletePdu (protocolFamily LOGISTICS) -received DIS PDU 10 REPAIR_RESPONSE of type edu.nps.moves.dis7.RepairResponsePdu (protocolFamily LOGISTICS) -received DIS PDU 11 CREATE_ENTITY of type edu.nps.moves.dis7.CreateEntityPdu (protocolFamily SIMULATION_MANAGEMENT) -received DIS PDU 12 REMOVE_ENTITY of type edu.nps.moves.dis7.RemoveEntityPdu (protocolFamily SIMULATION_MANAGEMENT) -received DIS PDU 13 START_RESUME of type edu.nps.moves.dis7.StartResumePdu (protocolFamily SIMULATION_MANAGEMENT) -received DIS PDU 14 STOP_FREEZE of type edu.nps.moves.dis7.StopFreezePdu (protocolFamily SIMULATION_MANAGEMENT) -received DIS PDU 15 ACKNOWLEDGE of type edu.nps.moves.dis7.AcknowledgePdu (protocolFamily SIMULATION_MANAGEMENT) -received DIS PDU 16 ACTION_REQUEST of type edu.nps.moves.dis7.ActionRequestPdu (protocolFamily SIMULATION_MANAGEMENT) -received DIS PDU 17 ACTION_RESPONSE of type edu.nps.moves.dis7.ActionResponsePdu (protocolFamily SIMULATION_MANAGEMENT) -received DIS PDU 18 DATA_QUERY of type edu.nps.moves.dis7.DataQueryPdu (protocolFamily SIMULATION_MANAGEMENT) -received DIS PDU 19 SET_DATA of type edu.nps.moves.dis7.SetDataPdu (protocolFamily SIMULATION_MANAGEMENT) -received DIS PDU 20 DATA of type edu.nps.moves.dis7.DataPdu (protocolFamily SIMULATION_MANAGEMENT) -received DIS PDU 21 EVENT_REPORT of type edu.nps.moves.dis7.EventReportPdu (protocolFamily SIMULATION_MANAGEMENT) -received DIS PDU 22 COMMENT of type edu.nps.moves.dis7.CommentPdu (protocolFamily SIMULATION_MANAGEMENT) -received DIS PDU 23 ELECTROMAGNETIC_EMISSION of type edu.nps.moves.dis7.ElectromagneticEmissionPdu (protocolFamily DISTRIBUTED_EMISSION_REGENERATION) -received DIS PDU 24 DESIGNATOR of type edu.nps.moves.dis7.DesignatorPdu (protocolFamily DISTRIBUTED_EMISSION_REGENERATION) -received DIS PDU 25 TRANSMITTER of type edu.nps.moves.dis7.TransmitterPdu (protocolFamily RADIO_COMMUNICATIONS) -received DIS PDU 26 SIGNAL of type edu.nps.moves.dis7.SignalPdu (protocolFamily RADIO_COMMUNICATIONS) -received DIS PDU 27 RECEIVER of type edu.nps.moves.dis7.ReceiverPdu (protocolFamily RADIO_COMMUNICATIONS) -received DIS PDU 28 IDENTIFICATION_FRIEND_OR_FOE of type edu.nps.moves.dis7.IFFPdu (protocolFamily DISTRIBUTED_EMISSION_REGENERATION) -received DIS PDU 29 UNDERWATER_ACOUSTIC of type edu.nps.moves.dis7.UnderwaterAcousticPdu (protocolFamily DISTRIBUTED_EMISSION_REGENERATION) -received DIS PDU 30 SUPPLEMENTAL_EMISSION_ENTITY_STATE of type edu.nps.moves.dis7.SEESPdu (protocolFamily DISTRIBUTED_EMISSION_REGENERATION) -received DIS PDU 31 INTERCOM_SIGNAL of type edu.nps.moves.dis7.IntercomSignalPdu (protocolFamily RADIO_COMMUNICATIONS) -received DIS PDU 32 INTERCOM_CONTROL of type edu.nps.moves.dis7.IntercomControlPdu (protocolFamily RADIO_COMMUNICATIONS) -received DIS PDU 33 AGGREGATE_STATE of type edu.nps.moves.dis7.AggregateStatePdu (protocolFamily ENTITY_MANAGEMENT) -received DIS PDU 34 ISGROUPOF of type edu.nps.moves.dis7.IsGroupOfPdu (protocolFamily ENTITY_MANAGEMENT) -received DIS PDU 35 TRANSFER_OWNERSHIP of type edu.nps.moves.dis7.TransferOwnershipPdu (protocolFamily ENTITY_MANAGEMENT) -received DIS PDU 36 ISPARTOF of type edu.nps.moves.dis7.IsPartOfPdu (protocolFamily ENTITY_MANAGEMENT) -received DIS PDU 37 MINEFIELD_STATE of type edu.nps.moves.dis7.MinefieldStatePdu (protocolFamily MINEFIELD) -received DIS PDU 38 MINEFIELD_QUERY of type edu.nps.moves.dis7.MinefieldQueryPdu (protocolFamily MINEFIELD) -received DIS PDU 39 MINEFIELD_DATA of type edu.nps.moves.dis7.MinefieldDataPdu (protocolFamily MINEFIELD) -received DIS PDU 40 MINEFIELD_RESPONSE_NACK of type edu.nps.moves.dis7.MinefieldResponseNACKPdu (protocolFamily MINEFIELD) -received DIS PDU 41 ENVIRONMENTAL_PROCESS of type edu.nps.moves.dis7.EnvironmentalProcessPdu (protocolFamily SYNTHETIC_ENVIRONMENT) -received DIS PDU 42 GRIDDED_DATA of type edu.nps.moves.dis7.GriddedDataPdu (protocolFamily SYNTHETIC_ENVIRONMENT) -received DIS PDU 43 POINT_OBJECT_STATE of type edu.nps.moves.dis7.PointObjectStatePdu (protocolFamily SYNTHETIC_ENVIRONMENT) -received DIS PDU 44 LINEAR_OBJECT_STATE of type edu.nps.moves.dis7.LinearObjectStatePdu (protocolFamily SYNTHETIC_ENVIRONMENT) -received DIS PDU 45 AREAL_OBJECT_STATE of type edu.nps.moves.dis7.ArealObjectStatePdu (protocolFamily SYNTHETIC_ENVIRONMENT) -received DIS PDU 46 TIME_SPACE_POSITION_INFORMATION of type edu.nps.moves.dis7.TSPIPdu (protocolFamily LIVE_ENTITY_LE_INFORMATION_INTERACTION) -received DIS PDU 47 APPEARANCE of type edu.nps.moves.dis7.AppearancePdu (protocolFamily LIVE_ENTITY_LE_INFORMATION_INTERACTION) -received DIS PDU 48 ARTICULATED_PARTS of type edu.nps.moves.dis7.ArticulatedPartsPdu (protocolFamily LIVE_ENTITY_LE_INFORMATION_INTERACTION) -received DIS PDU 49 LIVE_ENTITY_FIRE of type edu.nps.moves.dis7.LEFirePdu (protocolFamily LIVE_ENTITY_LE_INFORMATION_INTERACTION) -received DIS PDU 50 LIVE_ENTITY_DETONATION of type edu.nps.moves.dis7.LEDetonationPdu (protocolFamily LIVE_ENTITY_LE_INFORMATION_INTERACTION) -received DIS PDU 51 CREATE_ENTITY_RELIABLE of type edu.nps.moves.dis7.CreateEntityReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 52 REMOVE_ENTITY_RELIABLE of type edu.nps.moves.dis7.RemoveEntityReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 53 START_RESUME_RELIABLE of type edu.nps.moves.dis7.StartResumeReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 54 STOP_FREEZE_RELIABLE of type edu.nps.moves.dis7.StopFreezeReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 55 ACKNOWLEDGE_RELIABLE of type edu.nps.moves.dis7.AcknowledgeReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 56 ACTION_REQUEST_RELIABLE of type edu.nps.moves.dis7.ActionRequestReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 57 ACTION_RESPONSE_RELIABLE of type edu.nps.moves.dis7.ActionResponseReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 58 DATA_QUERY_RELIABLE of type edu.nps.moves.dis7.DataQueryReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 59 SET_DATA_RELIABLE of type edu.nps.moves.dis7.SetDataReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 60 DATA_RELIABLE of type edu.nps.moves.dis7.DataReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 61 EVENT_REPORT_RELIABLE of type edu.nps.moves.dis7.EventReportReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 62 COMMENT_RELIABLE of type edu.nps.moves.dis7.CommentReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 63 RECORD_RELIABLE of type edu.nps.moves.dis7.RecordReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 64 SET_RECORD_RELIABLE of type edu.nps.moves.dis7.SetRecordReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 65 RECORD_QUERY_RELIABLE of type edu.nps.moves.dis7.RecordQueryReliablePdu (protocolFamily SIMULATION_MANAGEMENT_WITH_RELIABILITY) -received DIS PDU 66 COLLISION_ELASTIC of type edu.nps.moves.dis7.CollisionElasticPdu (protocolFamily ENTITY_INFORMATION_INTERACTION) -received DIS PDU 67 ENTITY_STATE_UPDATE of type edu.nps.moves.dis7.EntityStateUpdatePdu (protocolFamily ENTITY_INFORMATION_INTERACTION) -received DIS PDU 68 DIRECTED_ENERGY_FIRE of type edu.nps.moves.dis7.DirectedEnergyFirePdu (protocolFamily WARFARE) -received DIS PDU 69 ENTITY_DAMAGE_STATUS of type edu.nps.moves.dis7.EntityDamageStatusPdu (protocolFamily WARFARE) -received DIS PDU 70 INFORMATION_OPERATIONS_ACTION of type edu.nps.moves.dis7.InformationOperationsActionPdu (protocolFamily INFORMATION_OPERATIONS) -received DIS PDU 71 INFORMATION_OPERATIONS_REPORT of type edu.nps.moves.dis7.InformationOperationsReportPdu (protocolFamily INFORMATION_OPERATIONS) -received DIS PDU 72 ATTRIBUTE of type edu.nps.moves.dis7.AttributePdu (protocolFamily ENTITY_INFORMATION_INTERACTION) -BUILD STOPPED (total time: 53 seconds) +ant -f C:\\x-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=run.single -Djavac.includes=OpenDis7Examples/AllPduReceiver.java -Drun.class=OpenDis7Examples.AllPduReceiver run-single +init: +Deleting: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties +deps-jar: +Updating property file: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties +Compiling 1 source file to C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\classes +warning: [options] bootstrap class path not set in conjunction with -source 8 +Note: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\src\OpenDis7Examples\AllPduReceiver.java uses or overrides a deprecated API. +Note: Recompile with -Xlint:deprecation for details. +Note: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\src\OpenDis7Examples\AllPduReceiver.java uses unchecked or unsafe operations. +Note: Recompile with -Xlint:unchecked for details. +1 warning +compile-single: +run-single: +[OpenDis7Examples.AllPduReceiver] started... +Usage: AllPduReceiver <multicast group> <port> +Default: AllPduReceiver 239.1.2.3 3000 +To quit: stop or kill this process +16:00:00 received new DIS PDU DISPDUType 1 ENTITY_STATE (DISProtocolFamily 1 ENTITY_INFORMATION_INTERACTION) +16:00:00 received new DIS PDU DISPDUType 2 FIRE (DISProtocolFamily 2 WARFARE) +16:00:00 received new DIS PDU DISPDUType 3 DETONATION (DISProtocolFamily 2 WARFARE) +16:00:00 received new DIS PDU DISPDUType 4 COLLISION (DISProtocolFamily 1 ENTITY_INFORMATION_INTERACTION) +16:00:00 received new DIS PDU DISPDUType 5 SERVICE_REQUEST (DISProtocolFamily 3 LOGISTICS) +16:00:00 received new DIS PDU DISPDUType 6 RESUPPLY_OFFER (DISProtocolFamily 3 LOGISTICS) +16:00:00 received new DIS PDU DISPDUType 7 RESUPPLY_RECEIVED (DISProtocolFamily 3 LOGISTICS) +16:00:00 received new DIS PDU DISPDUType 8 RESUPPLY_CANCEL (DISProtocolFamily 3 LOGISTICS) +16:00:00 received new DIS PDU DISPDUType 9 REPAIR_COMPLETE (DISProtocolFamily 3 LOGISTICS) +16:00:00 received new DIS PDU DISPDUType 10 REPAIR_RESPONSE (DISProtocolFamily 3 LOGISTICS) +16:00:00 received new DIS PDU DISPDUType 11 CREATE_ENTITY (DISProtocolFamily 5 SIMULATION_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 12 REMOVE_ENTITY (DISProtocolFamily 5 SIMULATION_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 13 START_RESUME (DISProtocolFamily 5 SIMULATION_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 14 STOP_FREEZE (DISProtocolFamily 5 SIMULATION_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 15 ACKNOWLEDGE (DISProtocolFamily 5 SIMULATION_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 16 ACTION_REQUEST (DISProtocolFamily 5 SIMULATION_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 17 ACTION_RESPONSE (DISProtocolFamily 5 SIMULATION_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 18 DATA_QUERY (DISProtocolFamily 5 SIMULATION_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 19 SET_DATA (DISProtocolFamily 5 SIMULATION_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 20 DATA (DISProtocolFamily 5 SIMULATION_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 21 EVENT_REPORT (DISProtocolFamily 5 SIMULATION_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 22 COMMENT (DISProtocolFamily 5 SIMULATION_MANAGEMENT) + messages: "Hello CommentPDU" "Here is a second line of text in this comment." +16:00:00 received new DIS PDU DISPDUType 23 ELECTROMAGNETIC_EMISSION (DISProtocolFamily 6 DISTRIBUTED_EMISSION_REGENERATION) +Jul 17, 2021 5:04:29 PM edu.nps.moves.dis7.utilities.PduFactory createPdu +SEVERE: unknown pduType=DISPDUType 0 OTHER, PduFactory fails +16:00:00 received new DIS PDU DISPDUType 24 DESIGNATOR (DISProtocolFamily 6 DISTRIBUTED_EMISSION_REGENERATION) +16:00:00 received new DIS PDU DISPDUType 25 TRANSMITTER (DISProtocolFamily 4 RADIO_COMMUNICATIONS) +16:00:00 received new DIS PDU DISPDUType 26 SIGNAL (DISProtocolFamily 4 RADIO_COMMUNICATIONS) +Jul 17, 2021 5:04:29 PM edu.nps.moves.dis7.utilities.PduFactory createPdu +SEVERE: unknown pduType=DISPDUType 0 OTHER, PduFactory fails +16:00:00 received new DIS PDU DISPDUType 27 RECEIVER (DISProtocolFamily 4 RADIO_COMMUNICATIONS) +16:00:00 received new DIS PDU DISPDUType 28 IDENTIFICATION_FRIEND_OR_FOE (DISProtocolFamily 6 DISTRIBUTED_EMISSION_REGENERATION) +16:00:00 received new DIS PDU DISPDUType 29 UNDERWATER_ACOUSTIC (DISProtocolFamily 6 DISTRIBUTED_EMISSION_REGENERATION) +16:00:00 received new DIS PDU DISPDUType 30 SUPPLEMENTAL_EMISSION_ENTITY_STATE (DISProtocolFamily 6 DISTRIBUTED_EMISSION_REGENERATION) +16:00:00 received new DIS PDU DISPDUType 31 INTERCOM_SIGNAL (DISProtocolFamily 4 RADIO_COMMUNICATIONS) +16:00:00 received new DIS PDU DISPDUType 32 INTERCOM_CONTROL (DISProtocolFamily 4 RADIO_COMMUNICATIONS) +16:00:00 received new DIS PDU DISPDUType 33 AGGREGATE_STATE (DISProtocolFamily 7 ENTITY_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 34 ISGROUPOF (DISProtocolFamily 7 ENTITY_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 35 TRANSFER_OWNERSHIP (DISProtocolFamily 7 ENTITY_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 36 ISPARTOF (DISProtocolFamily 7 ENTITY_MANAGEMENT) +16:00:00 received new DIS PDU DISPDUType 37 MINEFIELD_STATE (DISProtocolFamily 8 MINEFIELD) +16:00:00 received new DIS PDU DISPDUType 38 MINEFIELD_QUERY (DISProtocolFamily 8 MINEFIELD) +16:00:00 received new DIS PDU DISPDUType 39 MINEFIELD_DATA (DISProtocolFamily 8 MINEFIELD) +16:00:00 received new DIS PDU DISPDUType 40 MINEFIELD_RESPONSE_NACK (DISProtocolFamily 8 MINEFIELD) +16:00:00 received new DIS PDU DISPDUType 41 ENVIRONMENTAL_PROCESS (DISProtocolFamily 9 SYNTHETIC_ENVIRONMENT) +16:00:00 received new DIS PDU DISPDUType 42 GRIDDED_DATA (DISProtocolFamily 9 SYNTHETIC_ENVIRONMENT) +16:00:00 received new DIS PDU DISPDUType 43 POINT_OBJECT_STATE (DISProtocolFamily 9 SYNTHETIC_ENVIRONMENT) +16:00:00 received new DIS PDU DISPDUType 44 LINEAR_OBJECT_STATE (DISProtocolFamily 9 SYNTHETIC_ENVIRONMENT) +16:00:00 received new DIS PDU DISPDUType 45 AREAL_OBJECT_STATE (DISProtocolFamily 9 SYNTHETIC_ENVIRONMENT) +16:00:00 received new DIS PDU DISPDUType 46 TIME_SPACE_POSITION_INFORMATION (DISProtocolFamily 11 LIVE_ENTITY_LE_INFORMATION_INTERACTION) +16:00:00 received new DIS PDU DISPDUType 47 APPEARANCE (DISProtocolFamily 11 LIVE_ENTITY_LE_INFORMATION_INTERACTION) +16:00:00 received new DIS PDU DISPDUType 48 ARTICULATED_PARTS (DISProtocolFamily 11 LIVE_ENTITY_LE_INFORMATION_INTERACTION) +16:00:00 received new DIS PDU DISPDUType 49 LIVE_ENTITY_FIRE (DISProtocolFamily 11 LIVE_ENTITY_LE_INFORMATION_INTERACTION) +16:00:00 received new DIS PDU DISPDUType 50 LIVE_ENTITY_DETONATION (DISProtocolFamily 11 LIVE_ENTITY_LE_INFORMATION_INTERACTION) +16:00:00 received new DIS PDU DISPDUType 51 CREATE_ENTITY_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 52 REMOVE_ENTITY_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 53 START_RESUME_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 54 STOP_FREEZE_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 55 ACKNOWLEDGE_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 56 ACTION_REQUEST_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 57 ACTION_RESPONSE_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 58 DATA_QUERY_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 59 SET_DATA_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 60 DATA_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 61 EVENT_REPORT_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 62 COMMENT_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 63 RECORD_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 64 SET_RECORD_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 65 RECORD_QUERY_RELIABLE (DISProtocolFamily 10 SIMULATION_MANAGEMENT_WITH_RELIABILITY) +16:00:00 received new DIS PDU DISPDUType 66 COLLISION_ELASTIC (DISProtocolFamily 1 ENTITY_INFORMATION_INTERACTION) +16:00:00 received new DIS PDU DISPDUType 67 ENTITY_STATE_UPDATE (DISProtocolFamily 1 ENTITY_INFORMATION_INTERACTION) +16:00:00 received new DIS PDU DISPDUType 68 DIRECTED_ENERGY_FIRE (DISProtocolFamily 2 WARFARE) +16:00:00 received new DIS PDU DISPDUType 69 ENTITY_DAMAGE_STATUS (DISProtocolFamily 2 WARFARE) +16:00:00 received new DIS PDU DISPDUType 70 INFORMATION_OPERATIONS_ACTION (DISProtocolFamily 13 INFORMATION_OPERATIONS) +16:00:00 received new DIS PDU DISPDUType 71 INFORMATION_OPERATIONS_REPORT (DISProtocolFamily 13 INFORMATION_OPERATIONS) +16:00:00 received new DIS PDU DISPDUType 72 ATTRIBUTE (DISProtocolFamily 1 ENTITY_INFORMATION_INTERACTION) diff --git a/examples/src/OpenDis7Examples/AllPduSender.java b/examples/src/OpenDis7Examples/AllPduSender.java index e5162ed721..c5da07d2e8 100755 --- a/examples/src/OpenDis7Examples/AllPduSender.java +++ b/examples/src/OpenDis7Examples/AllPduSender.java @@ -447,7 +447,7 @@ public class AllPduSender } } if (generatedPdusList.size() != 72) // TODO create an enumeration DISType.TOTAL_PDU_TYPES - System.out.println("Error: " + generatedPdusList.size() + " PDUs generated but 72 PDUs expected."); + System.out.println("Error: " + generatedPdusList.size() + " PDUs generated, but 72 PDUs expected."); // Send the PDUs we created System.out.println("Send the " + generatedPdusList.size() + " PDUs we created..."); @@ -460,15 +460,16 @@ public class AllPduSender } multicastSocket.joinGroup(localMulticastAddress); - // keep object instantiations outside of loops for best performance - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - DataOutputStream dos = new DataOutputStream(baos); byte[] buffer; Pdu aPdu; DatagramPacket packet; for (int idx = 0; idx < generatedPdusList.size(); idx++) { + // careful here! keep object instantiations inside of loop to avoid endless array and packet growth + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + DataOutputStream dos = new DataOutputStream(baos); + aPdu = generatedPdusList.get(idx); try { @@ -479,7 +480,9 @@ public class AllPduSender multicastSocket.send(packet); String currentPduTypeValuePadded = String.format("%2s", aPdu.getPduType().getValue()); String currentPduTypePadded = String.format("%-50s", aPdu.getPduType().toString()); // - indicates right padding of whitespace + String packetLengthPadded = String.format("%3s", packet.getLength()); System.out.print ("Sent DIS PDU " + currentPduTypeValuePadded + " " + currentPduTypePadded ); + System.out.print ("(packet.getLength()=" + packetLengthPadded + ")"); // diagnostic, beware of ever-growing packet size! System.out.println(" of type " + aPdu.getClass().getName()); Thread.sleep(THREAD_SLEEP_INTERVAL); // pause for debugging, if zero this process still yields @@ -517,15 +520,14 @@ public class AllPduSender System.out.println("Usage: AllPduSender <multicast group> <port>"); System.out.println("Actual: AllPduSender " + multicastAddress.getHostAddress() + " " + port); allPduSender = new AllPduSender(args[0], Integer.parseInt(args[1])); - totalSentPdus = allPduSender.run(); } else { System.out.println("Usage: AllPduSender <multicast group> <port>"); System.out.println("Default: AllPduSender " + DEFAULT_MULTICAST_ADDRESS + " " + DEFAULT_MULTICAST_PORT); allPduSender = new AllPduSender(DEFAULT_MULTICAST_ADDRESS, DEFAULT_MULTICAST_PORT); - totalSentPdus = allPduSender.run(); } + totalSentPdus = allPduSender.run(); // do it to it System.out.println("OpenDis7Examples.AllPduSender complete, sent " + totalSentPdus + " PDUs total."); } } diff --git a/examples/src/OpenDis7Examples/AllPduSenderLog.txt b/examples/src/OpenDis7Examples/AllPduSenderLog.txt index 0fb9babe68..7fed2cce8a 100644 --- a/examples/src/OpenDis7Examples/AllPduSenderLog.txt +++ b/examples/src/OpenDis7Examples/AllPduSenderLog.txt @@ -1,93 +1,95 @@ -ant -f C:\\x-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=run.single -Djavac.includes=OpenDis7Examples/AllPduSender.java -Drun.class=OpenDis7Examples.AllPduSender run-single -init: -Deleting: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties -deps-jar: -Updating property file: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties -Compiling 1 source file to C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\classes -Note: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\src\OpenDis7Examples\AllPduSender.java uses or overrides a deprecated API. -Note: Recompile with -Xlint:deprecation for details. -compile-single: -run-single: -Usage: AllPduSender <port> <multicast group> -Default: AllPduSender 3000 225.4.5.6 -OpenDis7Examples.AllPduSender started... -Generate list of all PDU types and note issues, if any... -*** Note: DISPDUType.OTHER=0 not supported -Preparing CommentPDU: - "Hello CommentPDU" - "Here is a second line of text in this comment." -Send the 72 PDUs we created... -Sent DIS PDU 1 DISPDUType: 1 ENTITY_STATE of type edu.nps.moves.dis7.EntityStatePdu -Sent DIS PDU 2 DISPDUType: 2 FIRE of type edu.nps.moves.dis7.FirePdu -Sent DIS PDU 3 DISPDUType: 3 DETONATION of type edu.nps.moves.dis7.DetonationPdu -Sent DIS PDU 4 DISPDUType: 4 COLLISION of type edu.nps.moves.dis7.CollisionPdu -Sent DIS PDU 5 DISPDUType: 5 SERVICE_REQUEST of type edu.nps.moves.dis7.ServiceRequestPdu -Sent DIS PDU 6 DISPDUType: 6 RESUPPLY_OFFER of type edu.nps.moves.dis7.ResupplyOfferPdu -Sent DIS PDU 7 DISPDUType: 7 RESUPPLY_RECEIVED of type edu.nps.moves.dis7.ResupplyReceivedPdu -Sent DIS PDU 8 DISPDUType: 8 RESUPPLY_CANCEL of type edu.nps.moves.dis7.ResupplyCancelPdu -Sent DIS PDU 9 DISPDUType: 9 REPAIR_COMPLETE of type edu.nps.moves.dis7.RepairCompletePdu -Sent DIS PDU 10 DISPDUType: 10 REPAIR_RESPONSE of type edu.nps.moves.dis7.RepairResponsePdu -Sent DIS PDU 11 DISPDUType: 11 CREATE_ENTITY of type edu.nps.moves.dis7.CreateEntityPdu -Sent DIS PDU 12 DISPDUType: 12 REMOVE_ENTITY of type edu.nps.moves.dis7.RemoveEntityPdu -Sent DIS PDU 13 DISPDUType: 13 START_RESUME of type edu.nps.moves.dis7.StartResumePdu -Sent DIS PDU 14 DISPDUType: 14 STOP_FREEZE of type edu.nps.moves.dis7.StopFreezePdu -Sent DIS PDU 15 DISPDUType: 15 ACKNOWLEDGE of type edu.nps.moves.dis7.AcknowledgePdu -Sent DIS PDU 16 DISPDUType: 16 ACTION_REQUEST of type edu.nps.moves.dis7.ActionRequestPdu -Sent DIS PDU 17 DISPDUType: 17 ACTION_RESPONSE of type edu.nps.moves.dis7.ActionResponsePdu -Sent DIS PDU 18 DISPDUType: 18 DATA_QUERY of type edu.nps.moves.dis7.DataQueryPdu -Sent DIS PDU 19 DISPDUType: 19 SET_DATA of type edu.nps.moves.dis7.SetDataPdu -Sent DIS PDU 20 DISPDUType: 20 DATA of type edu.nps.moves.dis7.DataPdu -Sent DIS PDU 21 DISPDUType: 21 EVENT_REPORT of type edu.nps.moves.dis7.EventReportPdu -Sent DIS PDU 22 DISPDUType: 22 COMMENT of type edu.nps.moves.dis7.CommentPdu -Sent DIS PDU 23 DISPDUType: 23 ELECTROMAGNETIC_EMISSION of type edu.nps.moves.dis7.ElectromagneticEmissionPdu -Sent DIS PDU 24 DISPDUType: 24 DESIGNATOR of type edu.nps.moves.dis7.DesignatorPdu -Sent DIS PDU 25 DISPDUType: 25 TRANSMITTER of type edu.nps.moves.dis7.TransmitterPdu -Sent DIS PDU 26 DISPDUType: 26 SIGNAL of type edu.nps.moves.dis7.SignalPdu -Sent DIS PDU 27 DISPDUType: 27 RECEIVER of type edu.nps.moves.dis7.ReceiverPdu -Sent DIS PDU 28 DISPDUType: 28 IDENTIFICATION_FRIEND_OR_FOE of type edu.nps.moves.dis7.IdentificationFriendOrFoePdu -Sent DIS PDU 29 DISPDUType: 29 UNDERWATER_ACOUSTIC of type edu.nps.moves.dis7.UnderwaterAcousticPdu -Sent DIS PDU 30 DISPDUType: 30 SUPPLEMENTAL_EMISSION_ENTITY_STATE of type edu.nps.moves.dis7.SupplementalEmissionEntityStatePdu -Sent DIS PDU 31 DISPDUType: 31 INTERCOM_SIGNAL of type edu.nps.moves.dis7.IntercomSignalPdu -Sent DIS PDU 32 DISPDUType: 32 INTERCOM_CONTROL of type edu.nps.moves.dis7.IntercomControlPdu -Sent DIS PDU 33 DISPDUType: 33 AGGREGATE_STATE of type edu.nps.moves.dis7.AggregateStatePdu -Sent DIS PDU 34 DISPDUType: 34 ISGROUPOF of type edu.nps.moves.dis7.IsGroupOfPdu -Sent DIS PDU 35 DISPDUType: 35 TRANSFER_OWNERSHIP of type edu.nps.moves.dis7.TransferOwnershipPdu -Sent DIS PDU 36 DISPDUType: 36 ISPARTOF of type edu.nps.moves.dis7.IsPartOfPdu -Sent DIS PDU 37 DISPDUType: 37 MINEFIELD_STATE of type edu.nps.moves.dis7.MinefieldStatePdu -Sent DIS PDU 38 DISPDUType: 38 MINEFIELD_QUERY of type edu.nps.moves.dis7.MinefieldQueryPdu -Sent DIS PDU 39 DISPDUType: 39 MINEFIELD_DATA of type edu.nps.moves.dis7.MinefieldDataPdu -Sent DIS PDU 40 DISPDUType: 40 MINEFIELD_RESPONSE_NACK of type edu.nps.moves.dis7.MinefieldResponseNACKPdu -Sent DIS PDU 41 DISPDUType: 41 ENVIRONMENTAL_PROCESS of type edu.nps.moves.dis7.EnvironmentalProcessPdu -Sent DIS PDU 42 DISPDUType: 42 GRIDDED_DATA of type edu.nps.moves.dis7.GriddedDataPdu -Sent DIS PDU 43 DISPDUType: 43 POINT_OBJECT_STATE of type edu.nps.moves.dis7.PointObjectStatePdu -Sent DIS PDU 44 DISPDUType: 44 LINEAR_OBJECT_STATE of type edu.nps.moves.dis7.LinearObjectStatePdu -Sent DIS PDU 45 DISPDUType: 45 AREAL_OBJECT_STATE of type edu.nps.moves.dis7.ArealObjectStatePdu -Sent DIS PDU 46 DISPDUType: 46 TIME_SPACE_POSITION_INFORMATION of type edu.nps.moves.dis7.TimeSpacePositionInformationPdu -Sent DIS PDU 47 DISPDUType: 47 APPEARANCE of type edu.nps.moves.dis7.AppearancePdu -Sent DIS PDU 48 DISPDUType: 48 ARTICULATED_PARTS of type edu.nps.moves.dis7.ArticulatedPartsPdu -Sent DIS PDU 49 DISPDUType: 49 LIVE_ENTITY_FIRE of type edu.nps.moves.dis7.LiveEntityFirePdu -Sent DIS PDU 50 DISPDUType: 50 LIVE_ENTITY_DETONATION of type edu.nps.moves.dis7.LiveEntityDetonationPdu -Sent DIS PDU 51 DISPDUType: 51 CREATE_ENTITY_RELIABLE of type edu.nps.moves.dis7.CreateEntityReliablePdu -Sent DIS PDU 52 DISPDUType: 52 REMOVE_ENTITY_RELIABLE of type edu.nps.moves.dis7.RemoveEntityReliablePdu -Sent DIS PDU 53 DISPDUType: 53 START_RESUME_RELIABLE of type edu.nps.moves.dis7.StartResumeReliablePdu -Sent DIS PDU 54 DISPDUType: 54 STOP_FREEZE_RELIABLE of type edu.nps.moves.dis7.StopFreezeReliablePdu -Sent DIS PDU 55 DISPDUType: 55 ACKNOWLEDGE_RELIABLE of type edu.nps.moves.dis7.AcknowledgeReliablePdu -Sent DIS PDU 56 DISPDUType: 56 ACTION_REQUEST_RELIABLE of type edu.nps.moves.dis7.ActionRequestReliablePdu -Sent DIS PDU 57 DISPDUType: 57 ACTION_RESPONSE_RELIABLE of type edu.nps.moves.dis7.ActionResponseReliablePdu -Sent DIS PDU 58 DISPDUType: 58 DATA_QUERY_RELIABLE of type edu.nps.moves.dis7.DataQueryReliablePdu -Sent DIS PDU 59 DISPDUType: 59 SET_DATA_RELIABLE of type edu.nps.moves.dis7.SetDataReliablePdu -Sent DIS PDU 60 DISPDUType: 60 DATA_RELIABLE of type edu.nps.moves.dis7.DataReliablePdu -Sent DIS PDU 61 DISPDUType: 61 EVENT_REPORT_RELIABLE of type edu.nps.moves.dis7.EventReportReliablePdu -Sent DIS PDU 62 DISPDUType: 62 COMMENT_RELIABLE of type edu.nps.moves.dis7.CommentReliablePdu -Sent DIS PDU 63 DISPDUType: 63 RECORD_RELIABLE of type edu.nps.moves.dis7.RecordReliablePdu -Sent DIS PDU 64 DISPDUType: 64 SET_RECORD_RELIABLE of type edu.nps.moves.dis7.SetRecordReliablePdu -Sent DIS PDU 65 DISPDUType: 65 RECORD_QUERY_RELIABLE of type edu.nps.moves.dis7.RecordQueryReliablePdu -Sent DIS PDU 66 DISPDUType: 66 COLLISION_ELASTIC of type edu.nps.moves.dis7.CollisionElasticPdu -Sent DIS PDU 67 DISPDUType: 67 ENTITY_STATE_UPDATE of type edu.nps.moves.dis7.EntityStateUpdatePdu -Sent DIS PDU 68 DISPDUType: 68 DIRECTED_ENERGY_FIRE of type edu.nps.moves.dis7.DirectedEnergyFirePdu -Sent DIS PDU 69 DISPDUType: 69 ENTITY_DAMAGE_STATUS of type edu.nps.moves.dis7.EntityDamageStatusPdu -Sent DIS PDU 70 DISPDUType: 70 INFORMATION_OPERATIONS_ACTION of type edu.nps.moves.dis7.InformationOperationsActionPdu -Sent DIS PDU 71 DISPDUType: 71 INFORMATION_OPERATIONS_REPORT of type edu.nps.moves.dis7.InformationOperationsReportPdu -Sent DIS PDU 72 DISPDUType: 72 ATTRIBUTE of type edu.nps.moves.dis7.AttributePdu -OpenDis7Examples.AllPduSender complete, sent 72 PDUs total. -BUILD SUCCESSFUL (total time: 4 seconds) +ant -f C:\\x-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=run.single -Djavac.includes=OpenDis7Examples/AllPduSender.java -Drun.class=OpenDis7Examples.AllPduSender run-single +init: +Deleting: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties +deps-jar: +Updating property file: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties +Compiling 1 source file to C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\classes +warning: [options] bootstrap class path not set in conjunction with -source 8 +Note: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\src\OpenDis7Examples\AllPduSender.java uses or overrides a deprecated API. +Note: Recompile with -Xlint:deprecation for details. +1 warning +compile-single: +run-single: +Usage: AllPduSender <multicast group> <port> +Default: AllPduSender 239.1.2.3 3000 +OpenDis7Examples.AllPduSender started... +Generate list of all PDU types and note issues, if any... +*** Note: DISPDUType.OTHER=0 not supported +Preparing CommentPDU: + "Hello CommentPDU" + "Here is a second line of text in this comment." +Send the 72 PDUs we created... +Sent DIS PDU 1 DISPDUType 1 ENTITY_STATE (packet.getLength()=144) of type edu.nps.moves.dis7.pdus.EntityStatePdu +Sent DIS PDU 2 DISPDUType 2 FIRE (packet.getLength()= 96) of type edu.nps.moves.dis7.pdus.FirePdu +Sent DIS PDU 3 DISPDUType 3 DETONATION (packet.getLength()=104) of type edu.nps.moves.dis7.pdus.DetonationPdu +Sent DIS PDU 4 DISPDUType 4 COLLISION (packet.getLength()= 60) of type edu.nps.moves.dis7.pdus.CollisionPdu +Sent DIS PDU 5 DISPDUType 5 SERVICE_REQUEST (packet.getLength()= 28) of type edu.nps.moves.dis7.pdus.ServiceRequestPdu +Sent DIS PDU 6 DISPDUType 6 RESUPPLY_OFFER (packet.getLength()= 28) of type edu.nps.moves.dis7.pdus.ResupplyOfferPdu +Sent DIS PDU 7 DISPDUType 7 RESUPPLY_RECEIVED (packet.getLength()= 28) of type edu.nps.moves.dis7.pdus.ResupplyReceivedPdu +Sent DIS PDU 8 DISPDUType 8 RESUPPLY_CANCEL (packet.getLength()= 24) of type edu.nps.moves.dis7.pdus.ResupplyCancelPdu +Sent DIS PDU 9 DISPDUType 9 REPAIR_COMPLETE (packet.getLength()= 28) of type edu.nps.moves.dis7.pdus.RepairCompletePdu +Sent DIS PDU 10 DISPDUType 10 REPAIR_RESPONSE (packet.getLength()= 28) of type edu.nps.moves.dis7.pdus.RepairResponsePdu +Sent DIS PDU 11 DISPDUType 11 CREATE_ENTITY (packet.getLength()= 28) of type edu.nps.moves.dis7.pdus.CreateEntityPdu +Sent DIS PDU 12 DISPDUType 12 REMOVE_ENTITY (packet.getLength()= 28) of type edu.nps.moves.dis7.pdus.RemoveEntityPdu +Sent DIS PDU 13 DISPDUType 13 START_RESUME (packet.getLength()= 44) of type edu.nps.moves.dis7.pdus.StartResumePdu +Sent DIS PDU 14 DISPDUType 14 STOP_FREEZE (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.StopFreezePdu +Sent DIS PDU 15 DISPDUType 15 ACKNOWLEDGE (packet.getLength()= 32) of type edu.nps.moves.dis7.pdus.AcknowledgePdu +Sent DIS PDU 16 DISPDUType 16 ACTION_REQUEST (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.ActionRequestPdu +Sent DIS PDU 17 DISPDUType 17 ACTION_RESPONSE (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.ActionResponsePdu +Sent DIS PDU 18 DISPDUType 18 DATA_QUERY (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.DataQueryPdu +Sent DIS PDU 19 DISPDUType 19 SET_DATA (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.SetDataPdu +Sent DIS PDU 20 DISPDUType 20 DATA (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.DataPdu +Sent DIS PDU 21 DISPDUType 21 EVENT_REPORT (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.EventReportPdu +Sent DIS PDU 22 DISPDUType 22 COMMENT (packet.getLength()=112) of type edu.nps.moves.dis7.pdus.CommentPdu +Sent DIS PDU 23 DISPDUType 23 ELECTROMAGNETIC_EMISSION (packet.getLength()= 28) of type edu.nps.moves.dis7.pdus.ElectromagneticEmissionPdu +Sent DIS PDU 24 DISPDUType 24 DESIGNATOR (packet.getLength()= 88) of type edu.nps.moves.dis7.pdus.DesignatorPdu +Sent DIS PDU 25 DISPDUType 25 TRANSMITTER (packet.getLength()=107) of type edu.nps.moves.dis7.pdus.TransmitterPdu +Sent DIS PDU 26 DISPDUType 26 SIGNAL (packet.getLength()= 36) of type edu.nps.moves.dis7.pdus.SignalPdu +Sent DIS PDU 27 DISPDUType 27 RECEIVER (packet.getLength()= 36) of type edu.nps.moves.dis7.pdus.ReceiverPdu +Sent DIS PDU 28 DISPDUType 28 IDENTIFICATION_FRIEND_OR_FOE (packet.getLength()= 60) of type edu.nps.moves.dis7.pdus.IdentificationFriendOrFoePdu +Sent DIS PDU 29 DISPDUType 29 UNDERWATER_ACOUSTIC (packet.getLength()= 32) of type edu.nps.moves.dis7.pdus.UnderwaterAcousticPdu +Sent DIS PDU 30 DISPDUType 30 SUPPLEMENTAL_EMISSION_ENTITY_STATE (packet.getLength()= 28) of type edu.nps.moves.dis7.pdus.SupplementalEmissionEntityStatePdu +Sent DIS PDU 31 DISPDUType 31 INTERCOM_SIGNAL (packet.getLength()= 36) of type edu.nps.moves.dis7.pdus.IntercomSignalPdu +Sent DIS PDU 32 DISPDUType 32 INTERCOM_CONTROL (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.IntercomControlPdu +Sent DIS PDU 33 DISPDUType 33 AGGREGATE_STATE (packet.getLength()=136) of type edu.nps.moves.dis7.pdus.AggregateStatePdu +Sent DIS PDU 34 DISPDUType 34 ISGROUPOF (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.IsGroupOfPdu +Sent DIS PDU 35 DISPDUType 35 TRANSFER_OWNERSHIP (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.TransferOwnershipPdu +Sent DIS PDU 36 DISPDUType 36 ISPARTOF (packet.getLength()= 52) of type edu.nps.moves.dis7.pdus.IsPartOfPdu +Sent DIS PDU 37 DISPDUType 37 MINEFIELD_STATE (packet.getLength()= 72) of type edu.nps.moves.dis7.pdus.MinefieldStatePdu +Sent DIS PDU 38 DISPDUType 38 MINEFIELD_QUERY (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.MinefieldQueryPdu +Sent DIS PDU 39 DISPDUType 39 MINEFIELD_DATA (packet.getLength()= 44) of type edu.nps.moves.dis7.pdus.MinefieldDataPdu +Sent DIS PDU 40 DISPDUType 40 MINEFIELD_RESPONSE_NACK (packet.getLength()= 26) of type edu.nps.moves.dis7.pdus.MinefieldResponseNACKPdu +Sent DIS PDU 41 DISPDUType 41 ENVIRONMENTAL_PROCESS (packet.getLength()= 32) of type edu.nps.moves.dis7.pdus.EnvironmentalProcessPdu +Sent DIS PDU 42 DISPDUType 42 GRIDDED_DATA (packet.getLength()= 64) of type edu.nps.moves.dis7.pdus.GriddedDataPdu +Sent DIS PDU 43 DISPDUType 43 POINT_OBJECT_STATE (packet.getLength()= 91) of type edu.nps.moves.dis7.pdus.PointObjectStatePdu +Sent DIS PDU 44 DISPDUType 44 LINEAR_OBJECT_STATE (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.LinearObjectStatePdu +Sent DIS PDU 45 DISPDUType 45 AREAL_OBJECT_STATE (packet.getLength()= 49) of type edu.nps.moves.dis7.pdus.ArealObjectStatePdu +Sent DIS PDU 46 DISPDUType 46 TIME_SPACE_POSITION_INFORMATION (packet.getLength()= 54) of type edu.nps.moves.dis7.pdus.TimeSpacePositionInformationPdu +Sent DIS PDU 47 DISPDUType 47 APPEARANCE (packet.getLength()= 67) of type edu.nps.moves.dis7.pdus.AppearancePdu +Sent DIS PDU 48 DISPDUType 48 ARTICULATED_PARTS (packet.getLength()= 17) of type edu.nps.moves.dis7.pdus.ArticulatedPartsPdu +Sent DIS PDU 49 DISPDUType 49 LIVE_ENTITY_FIRE (packet.getLength()= 67) of type edu.nps.moves.dis7.pdus.LiveEntityFirePdu +Sent DIS PDU 50 DISPDUType 50 LIVE_ENTITY_DETONATION (packet.getLength()= 79) of type edu.nps.moves.dis7.pdus.LiveEntityDetonationPdu +Sent DIS PDU 51 DISPDUType 51 CREATE_ENTITY_RELIABLE (packet.getLength()= 32) of type edu.nps.moves.dis7.pdus.CreateEntityReliablePdu +Sent DIS PDU 52 DISPDUType 52 REMOVE_ENTITY_RELIABLE (packet.getLength()= 32) of type edu.nps.moves.dis7.pdus.RemoveEntityReliablePdu +Sent DIS PDU 53 DISPDUType 53 START_RESUME_RELIABLE (packet.getLength()= 48) of type edu.nps.moves.dis7.pdus.StartResumeReliablePdu +Sent DIS PDU 54 DISPDUType 54 STOP_FREEZE_RELIABLE (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.StopFreezeReliablePdu +Sent DIS PDU 55 DISPDUType 55 ACKNOWLEDGE_RELIABLE (packet.getLength()= 32) of type edu.nps.moves.dis7.pdus.AcknowledgeReliablePdu +Sent DIS PDU 56 DISPDUType 56 ACTION_REQUEST_RELIABLE (packet.getLength()= 44) of type edu.nps.moves.dis7.pdus.ActionRequestReliablePdu +Sent DIS PDU 57 DISPDUType 57 ACTION_RESPONSE_RELIABLE (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.ActionResponseReliablePdu +Sent DIS PDU 58 DISPDUType 58 DATA_QUERY_RELIABLE (packet.getLength()= 44) of type edu.nps.moves.dis7.pdus.DataQueryReliablePdu +Sent DIS PDU 59 DISPDUType 59 SET_DATA_RELIABLE (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.SetDataReliablePdu +Sent DIS PDU 60 DISPDUType 60 DATA_RELIABLE (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.DataReliablePdu +Sent DIS PDU 61 DISPDUType 61 EVENT_REPORT_RELIABLE (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.EventReportReliablePdu +Sent DIS PDU 62 DISPDUType 62 COMMENT_RELIABLE (packet.getLength()= 32) of type edu.nps.moves.dis7.pdus.CommentReliablePdu +Sent DIS PDU 63 DISPDUType 63 RECORD_RELIABLE (packet.getLength()= 36) of type edu.nps.moves.dis7.pdus.RecordReliablePdu +Sent DIS PDU 64 DISPDUType 64 SET_RECORD_RELIABLE (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.SetRecordReliablePdu +Sent DIS PDU 65 DISPDUType 65 RECORD_QUERY_RELIABLE (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.RecordQueryReliablePdu +Sent DIS PDU 66 DISPDUType 66 COLLISION_ELASTIC (packet.getLength()=100) of type edu.nps.moves.dis7.pdus.CollisionElasticPdu +Sent DIS PDU 67 DISPDUType 67 ENTITY_STATE_UPDATE (packet.getLength()= 72) of type edu.nps.moves.dis7.pdus.EntityStateUpdatePdu +Sent DIS PDU 68 DISPDUType 68 DIRECTED_ENERGY_FIRE (packet.getLength()= 88) of type edu.nps.moves.dis7.pdus.DirectedEnergyFirePdu +Sent DIS PDU 69 DISPDUType 69 ENTITY_DAMAGE_STATUS (packet.getLength()= 24) of type edu.nps.moves.dis7.pdus.EntityDamageStatusPdu +Sent DIS PDU 70 DISPDUType 70 INFORMATION_OPERATIONS_ACTION (packet.getLength()= 56) of type edu.nps.moves.dis7.pdus.InformationOperationsActionPdu +Sent DIS PDU 71 DISPDUType 71 INFORMATION_OPERATIONS_REPORT (packet.getLength()= 40) of type edu.nps.moves.dis7.pdus.InformationOperationsReportPdu +Sent DIS PDU 72 DISPDUType 72 ATTRIBUTE (packet.getLength()= 32) of type edu.nps.moves.dis7.pdus.AttributePdu +OpenDis7Examples.AllPduSender complete, sent 72 PDUs total. +BUILD SUCCESSFUL (total time: 4 seconds) diff --git a/examples/src/OpenDis7Examples/EspduSender.java b/examples/src/OpenDis7Examples/EspduSender.java index b18ae8d025..8909d65c09 100644 --- a/examples/src/OpenDis7Examples/EspduSender.java +++ b/examples/src/OpenDis7Examples/EspduSender.java @@ -213,7 +213,7 @@ public class EspduSender { System.out.println(TRACE_PREFIX + "sending " + SEND_LOOPS_TO_PERFORM + " sets of packets:"); // + address.toString() - for (int index = 0; index < SEND_LOOPS_TO_PERFORM; index++) + for (int index = 1; index <= SEND_LOOPS_TO_PERFORM; index++) { // DIS time is a pain in the uh, neck. DIS time units are 2^31-1 units per // hour, and time is set to DIS time units from the top of the hour. @@ -302,6 +302,8 @@ public class EspduSender firePdu.setLocationInWorldCoordinates(espdu.getEntityLocation()); byte[] fireArray = firePdu.marshal(); + System.out.println("FirePdu #" + index + " firePdu=[FireMissionIndex=" + firePdu.getFireMissionIndex() + ", descriptor=" + firePdu.getDescriptor()+ "]"); + // CommentPdu newCommentPdu = new CommentPdu(); // ArrayList<VariableDatum> payloadList = new ArrayList<>(); // ArrayList<String> commentsList = new ArrayList<>(); @@ -327,17 +329,19 @@ public class EspduSender for (InetAddress networkAddress : localNetworkAddresses) { if (espduArray.length > 0) { - System.out.println(TRACE_PREFIX + "sending datagram packet [" + espdu.getPduType().toString() + "] to " + - String.format("%-15s", networkAddress.getHostAddress()) + " port " + port); packet = new DatagramPacket(espduArray, espduArray.length, networkAddress, port); + System.out.println(TRACE_PREFIX + "sending datagram packet [" + espdu.getPduType().toString() + "] " + + "packet.getLength()=" + packet.getLength() + ", " + // diagnostic, beware of ever-growing packet size + String.format("to %-15s", networkAddress.getHostAddress()) + " port " + port); socket.send(packet); } // TODO experiment with these! 8) if (fireArray.length > 0) { - System.out.println(TRACE_PREFIX + "sending datagram packet [" + firePdu.getPduType().toString() + " ] to " + - String.format("%-15s", networkAddress.getHostAddress()) + " port " + port); packet = new DatagramPacket(fireArray, fireArray.length, networkAddress, port); // alternate + System.out.println(TRACE_PREFIX + "sending datagram packet [" + firePdu.getPduType().toString() + " ] " + + "packet.getLength()= " + packet.getLength() + ", " + // diagnostic, beware of ever-growing packet size + String.format("to %-15s", networkAddress.getHostAddress()) + " port " + port); socket.send(packet); } // // TODO experiment with these! 8) diff --git a/examples/src/OpenDis7Examples/EspduTerminalLog.txt b/examples/src/OpenDis7Examples/EspduTerminalLog.txt index 714e291b53..4ed84791f0 100644 --- a/examples/src/OpenDis7Examples/EspduTerminalLog.txt +++ b/examples/src/OpenDis7Examples/EspduTerminalLog.txt @@ -1,52 +1,74 @@ -Invocation instructions: -1. run/debug EspduReceiver.java (since sender does not block, first be ready to listen) -2. run/debug EspduSender.java - -Program responses, sender and receiver: - -=================================================== -run: - -[OpenDis7Examples.EspduSender] started... -[OpenDis7Examples.EspduSender] sending multicast ESPDU packets to 239.1.2.3 port 3000 -=============== -espdu entityType information: - EntityKind =EntityKind 1 PLATFORM - Country =Country 225 UNITED_STATES_OF_AMERICA_USA - Domain =Land - Category =1 - SubCategory=1 - Specific =Country 225 UNITED_STATES_OF_AMERICA_USA -[OpenDis7Examples.EspduSender] sending 1 sets of packets: -=============== -Create new PDUs - latitude, longitude: [36.595517, -121.87693999999999] - coordinate conversion: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -Espdu #0 entityID=[1,2,3] -[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 1 ENTITY_STATE] to 127.255.255.255 port 3000 -[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 2 FIRE ] to 127.255.255.255 port 3000 -[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 1 ENTITY_STATE] to 172.20.209.222 port 3000 -[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 2 FIRE ] to 172.20.209.222 port 3000 -[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 1 ENTITY_STATE] to 172.16.0.255 port 3000 -[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 2 FIRE ] to 172.16.0.255 port 3000 -=============== -[OpenDis7Examples.EspduSender] complete. -BUILD SUCCESSFUL (total time: 3 seconds) - -=================================================== - -[OpenDis7Examples.EspduReceiver] started... -[OpenDis7Examples.EspduReceiver] listening for PDU packets on 239.1.2.3 port 3000 -=============== - 1. received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.pdus.EntityStatePdu - entityID triplet: [1, 2, 3] - Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] - 2. received PDU type 2=FIRE edu.nps.moves.dis7.pdus.FirePdu - FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -=============== - 3. received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.pdus.EntityStatePdu - entityID triplet: [1, 2, 3] - Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] - 4. received PDU type 2=FIRE edu.nps.moves.dis7.pdus.FirePdu - FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] +Invocation instructions: +1. run/debug EspduReceiver.java (since sender does not block, first be ready to listen) +2. run/debug EspduSender.java + +Program responses, sender and receiver: + +=================================================== +ant -f C:\\x-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=run.single -Djavac.includes=OpenDis7Examples/EspduSender.java -Drun.class=OpenDis7Examples.EspduSender run-single +init: +Deleting: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties +deps-jar: +Updating property file: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties +Compiling 1 source file to C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\build\classes +warning: [options] bootstrap class path not set in conjunction with -source 8 +Note: C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\src\OpenDis7Examples\EspduSender.java uses or overrides a deprecated API. +Note: Recompile with -Xlint:deprecation for details. +1 warning +compile-single: +run-single: +[OpenDis7Examples.EspduSender] started... +[OpenDis7Examples.EspduSender] sending multicast ESPDU packets to 239.1.2.3 port 3000 +=============== +espdu entityType information: + EntityKind =EntityKind 1 PLATFORM + Country =Country 225 UNITED_STATES_OF_AMERICA_USA + Domain =Land + Category =1 + SubCategory=1 + Specific =Country 225 UNITED_STATES_OF_AMERICA_USA +[OpenDis7Examples.EspduSender] sending 1 sets of packets: +=============== +Create new PDUs + latitude, longitude: [36.595517, -121.87706] + coordinate conversion: [-2707497.4860692197, -4353661.0646844525, 3781450.3202754413] +Espdu #1 entityID=[1,2,3] +FirePdu #1 firePdu=[FireMissionIndex=0, descriptor=MunitionDescriptor: + munitionType: EntityType: + entityKind: EntityKind 0 OTHER + domain: Other + country: Country 0 OTHER + category: 0 + subCategory: 0 + specific: 0 + extra: 0 + + warhead: MunitionDescriptorWarhead 0 OTHER + fuse: MunitionDescriptorFuse 0 OTHER + quantity: 0 + rate: 0 +] +[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 1 ENTITY_STATE] packet.getLength()=144, to 127.255.255.255 port 3000 +[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 2 FIRE ] packet.getLength()= 96, to 127.255.255.255 port 3000 +[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 1 ENTITY_STATE] packet.getLength()=144, to 172.19.143.255 port 3000 +[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 2 FIRE ] packet.getLength()= 96, to 172.19.143.255 port 3000 +[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 1 ENTITY_STATE] packet.getLength()=144, to 10.0.0.255 port 3000 +[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 2 FIRE ] packet.getLength()= 96, to 10.0.0.255 port 3000 +[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 1 ENTITY_STATE] packet.getLength()=144, to 172.20.209.219 port 3000 +[OpenDis7Examples.EspduSender] sending datagram packet [DISPDUType 2 FIRE ] packet.getLength()= 96, to 172.20.209.219 port 3000 +=============== +[OpenDis7Examples.EspduSender] complete. +BUILD SUCCESSFUL (total time: 5 seconds) + +=================================================== + +[OpenDis7Examples.EspduReceiver] started... +[OpenDis7Examples.EspduReceiver] listening for PDU packets on 239.1.2.3 port 3000 +To quit: stop or kill this process +=============== + 1. received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.pdus.EntityStatePdu + entityID triplet: [1, 2, 3] + Location in DIS coordinates: [-2707497.4860692197, -4353661.0646844525, 3781450.3202754413] + 2. received PDU type 2=FIRE edu.nps.moves.dis7.pdus.FirePdu + FirePdu locationInWorldCoordinates: [-2707497.4860692197, -4353661.0646844525, 3781450.3202754413] =============== \ No newline at end of file -- GitLab