diff --git a/MV3500NetworkedGraphicsSyllabus2020JulySeptember.doc b/MV3500NetworkedGraphicsSyllabus2020JulySeptember.doc index 27e0e253c57e04d805acacd87bdbd55df954beea..54c4806d71c9c5f8f485407f170f90bc7f359ada 100644 Binary files a/MV3500NetworkedGraphicsSyllabus2020JulySeptember.doc and b/MV3500NetworkedGraphicsSyllabus2020JulySeptember.doc differ diff --git a/MV3500NetworkedGraphicsSyllabus2020JulySeptember.pdf b/MV3500NetworkedGraphicsSyllabus2020JulySeptember.pdf index 7340176e02d5c73eed8343604672024da32f1c3b..e2483d7ab1d80d78e44e6b3b5f80748ced084bff 100644 Binary files a/MV3500NetworkedGraphicsSyllabus2020JulySeptember.pdf and b/MV3500NetworkedGraphicsSyllabus2020JulySeptember.pdf differ diff --git a/assignments/ReportingForDuty.md b/assignments/ReportingForDuty.md index 2dd3bf098912c6a64e6de341d0d40d98c496723a..68b2788da2e586672663df83ecacebc909588baa 100644 --- a/assignments/ReportingForDuty.md +++ b/assignments/ReportingForDuty.md @@ -25,6 +25,7 @@ More information on your use of Git is in the parent directory [README.md](../.. - Christopher Cannon - Bill Mahan + --- ### 2019 @@ -44,5 +45,3 @@ More information on your use of Git is in the parent directory [README.md](../.. - Bert Knobeloch - Tobias Brennenstuhl aka Sir Tobi - - diff --git a/assignments/build.xml b/assignments/build.xml index 2b8c338bb1277d3f5f33939476fdbfda4bdca00e..427209286b71ecf9a9b0e210292b9ee53274a4ee 100644 --- a/assignments/build.xml +++ b/assignments/build.xml @@ -7,7 +7,7 @@ <!-- the Compile on Save feature is turned off for the project. --> <!-- You can turn off the Compile on Save (or Deploy on Save) setting --> <!-- in the project's Project Properties dialog box.--> -<project name="MV3500_Deliverables" default="default" basedir="."> +<project name="MV3500 assignments" default="default" basedir="."> <description>Builds, tests, and runs the MV3500 project assignments</description> <import file="nbproject/build-impl.xml"/> <!-- diff --git a/assignments/nbproject/project.properties b/assignments/nbproject/project.properties index 05c6f493d71c7f76c47f470d33e5afb981989e3e..6e6876fa79820b0ea57290915c0a9c2e2b7dd733 100644 --- a/assignments/nbproject/project.properties +++ b/assignments/nbproject/project.properties @@ -1,130 +1,128 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.desc=Student assignments performed as part of course Networked Graphics MV3500 -application.homepage=https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/tree/master/assignments -application.title=Networked Graphics MV3500 assignments -application.vendor=Don Brutzman -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.modulepath=\ - ${run.modulepath} -debug.test.classpath=\ - ${run.test.classpath} -debug.test.modulepath=\ - ${run.test.modulepath} -# Files in build.classes.dir which should be excluded from distribution jar -dist.archive.excludes= -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/Networked_Graphics_MV3500_assignments.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -file.reference.commons-io-2.6.jar=../lib/commons-io-2.6.jar -file.reference.dis-enums-1.3.jar=../lib/dis-enums-1.3.jar -file.reference.guava-28.0-jre.jar=../lib/guava-28.0-jre.jar -file.reference.open-dis7-entities-all.jar=../lib/open-dis7-entities-all.jar -file.reference.open-dis7-java.jar=../lib/open-dis7-java.jar -file.reference.open-dis7-javadoc.jar=../lib/open-dis7-javadoc.jar -file.reference.open-dis7-source.jar=../lib/open-dis7-source.jar -file.reference.open-dis_4.16.jar=../lib/open-dis_4.16.jar -includes=** -jar.archive.disabled=${jnlp.enabled} -jar.compress=false -jar.index=${jnlp.enabled} -javac.classpath=\ - ${file.reference.open-dis7-entities-all.jar}:\ - ${file.reference.open-dis7-java.jar}:\ - ${file.reference.open-dis7-javadoc.jar}:\ - ${file.reference.open-dis7-source.jar}:\ - ${file.reference.commons-io-2.6.jar}:\ - ${file.reference.guava-28.0-jre.jar}:\ - ${file.reference.open-dis_4.16.jar}:\ - ${file.reference.dis-enums-1.3.jar} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.external.vm=true -javac.modulepath= -javac.processormodulepath= -javac.processorpath=\ - ${javac.classpath} -javac.source=1.8 -javac.target=1.8 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.modulepath=\ - ${javac.modulepath} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.html5=false -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.reference.open-dis7-java.jar=../lib/open-dis7-javadoc.jar -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -jlink.launcher=false -jlink.launcher.name=Networked_Graphics_MV3500_assignments -jnlp.codebase.type=no.codebase -jnlp.descriptor=application -jnlp.enabled=false -jnlp.mixed.code=default -jnlp.offline-allowed=false -jnlp.signed=false -jnlp.signing= -jnlp.signing.alias= -jnlp.signing.keystore= -main.class=MV3500Cohort2020JulySeptember.homework1.WeissenbergerTcpExample1Telnet -# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found. -manifest.custom.application.library.allowable.codebase= -# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts. -manifest.custom.caller.allowable.codebase= -# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed -manifest.custom.codebase= -# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) -manifest.custom.permissions= -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false -platform.active=default_platform -project.licensePath=../license.txt -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project. -# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. -# To set system properties for unit tests define test-sys-prop.name=value: -run.jvmargs= -run.modulepath=\ - ${javac.modulepath} -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -run.test.modulepath=\ - ${javac.test.modulepath} -source.encoding=UTF-8 -source.reference.open-dis7-java.jar=../lib/open-dis7-source.jar -src.dir=src -test.src.dir=test +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.desc=Student assignments performed as part of NPS course Networked Graphics MV3500. This course is an introduction to network communications in simulation applications. Topics include an introduction to the TCP/IP protocol stack; TCP/IP socket communications, including TCP, UDP, and multicast; and protocol design issues, with emphasis on Distributed Interactive Simulation (DIS) Protocol and High Level Architecture (HLA). Course emphasis is on creation and testing of network programming network code and web-browser applications. +application.homepage=https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/tree/master/assignments +application.splash=../..\\NetworkedGraphicsMV3500\\documentation\\images\\OpenDisSurferDude.png +application.title=NPS Networked Graphics MV3500 assignments +application.vendor=Don Brutzman +auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.modulepath=\ + ${run.modulepath} +debug.test.classpath=\ + ${run.test.classpath} +debug.test.modulepath=\ + ${run.test.modulepath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/Networked_Graphics_MV3500_assignments.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.commons-io-2.6.jar=../lib/commons-io-2.6.jar +file.reference.dis-enums-1.3.jar=../lib/dis-enums-1.3.jar +file.reference.guava-28.0-jre.jar=../lib/guava-28.0-jre.jar +file.reference.open-dis7-enumerations-classes.jar=../lib/open-dis7-enumerations-classes.jar +file.reference.open-dis7-pdus-classes.jar=../lib/open-dis7-pdus-classes.jar +file.reference.open-dis_4.16.jar=../lib/open-dis_4.16.jar +includes=** +jar.archive.disabled=${jnlp.enabled} +jar.compress=false +jar.index=${jnlp.enabled} +javac.classpath=\ + ${file.reference.open-dis7-enumerations-classes.jar}:\ + ${file.reference.open-dis7-pdus-classes.jar}:\ + ${file.reference.commons-io-2.6.jar}:\ + ${file.reference.guava-28.0-jre.jar}:\ + ${file.reference.open-dis_4.16.jar}:\ + ${file.reference.dis-enums-1.3.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.modulepath= +javac.processormodulepath= +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.modulepath=\ + ${javac.modulepath} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=true +javadoc.encoding=${source.encoding} +javadoc.html5=false +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.reference.open-dis7-enumerations-classes.jar=../lib/open-dis7-enumerations-javadoc.jar +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle=Networked Graphics MV3500 NPS +jlink.launcher=false +jlink.launcher.name=Networked_Graphics_MV3500_assignments +jnlp.codebase.type=no.codebase +jnlp.descriptor=application +jnlp.enabled=false +jnlp.mixed.code=default +jnlp.offline-allowed=false +jnlp.signed=false +jnlp.signing= +jnlp.signing.alias= +jnlp.signing.keystore= +main.class=MV3500Cohort2020JulySeptember.homework1.WeissenbergerTcpExample1Telnet +# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found. +manifest.custom.application.library.allowable.codebase= +# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts. +manifest.custom.caller.allowable.codebase= +# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed +manifest.custom.codebase= +# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) +manifest.custom.permissions= +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +project.licensePath=../license.txt +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.modulepath=\ + ${javac.modulepath} +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +run.test.modulepath=\ + ${javac.test.modulepath} +source.encoding=UTF-8 +source.reference.open-dis7-enumerations-classes.jar=../lib/open-dis7-enumerations-source.jar +src.dir=src +test.src.dir=test diff --git a/assignments/nbproject/project.xml b/assignments/nbproject/project.xml index a8deed1628f74f99861205f0c0c7df64c605b09b..042a5d4de46fba4c89134e0e68f7624366a0b5cb 100644 --- a/assignments/nbproject/project.xml +++ b/assignments/nbproject/project.xml @@ -1,27 +1,27 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://www.netbeans.org/ns/project/1"> - <type>org.netbeans.modules.java.j2seproject</type> - <configuration> - <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> - <name>Networked Graphics MV3500 assignments</name> - <source-roots> - <root id="src.dir"/> - </source-roots> - <test-roots> - <root id="test.src.dir"/> - </test-roots> - </data> - <spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1"> - <word>deliverables</word> - <word>https</word> - <word>localhost</word> - <word>multicast</word> - <word>Netbeans</word> - <word>README</word> - <word>UML</word> - <word>unicast</word> - <word>wikipedia</word> - <word>Wireshark</word> - </spellchecker-wordlist> - </configuration> -</project> +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://www.netbeans.org/ns/project/1"> + <type>org.netbeans.modules.java.j2seproject</type> + <configuration> + <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> + <name>Networked Graphics MV3500 assignments</name> + <source-roots> + <root id="src.dir"/> + </source-roots> + <test-roots> + <root id="test.src.dir"/> + </test-roots> + </data> + <spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1"> + <word>deliverables</word> + <word>https</word> + <word>localhost</word> + <word>multicast</word> + <word>Netbeans</word> + <word>README</word> + <word>UML</word> + <word>unicast</word> + <word>wikipedia</word> + <word>Wireshark</word> + </spellchecker-wordlist> + </configuration> +</project> diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronEntityStatePduCreator.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronEntityStatePduCreator.java index 855dd84aa16cd0cac511c23f1d2f8bdf35ee27a3..34508ef781c51af57a2c5f2583ede88c1b27a6a2 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronEntityStatePduCreator.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronEntityStatePduCreator.java @@ -1,7 +1,6 @@ package MV3500Cohort2019JulySeptember.homework4.Boron; -import edu.nps.moves.dis7.*; -import edu.nps.moves.dis7.enumerations.DISPDUType; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.ForceID; /** @@ -22,7 +21,7 @@ public class BoronEntityStatePduCreator { * @param l is a double array containing position x,y,z coordinates * @param v is a float array containing x,y,z velocity values * @param o is a float array containing phi, psi, and theta orientation values - * @returns a new EntityStatePdu with minimal information + * @return a new EntityStatePdu with minimal information */ public EntityStatePdu newPDU(short s, ForceID fid, double [] l, float[] v, float[] o) { diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduReceiver.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduReceiver.java index 70dee43862fe0b9ee68409863b1629a37db028a2..9e35f29175237a525c43b2036e9319059a7965cb 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduReceiver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduReceiver.java @@ -3,7 +3,7 @@ package MV3500Cohort2019JulySeptember.homework4.Boron; import java.net.*; import java.io.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; import static edu.nps.moves.dis7.enumerations.DISPDUType.*; import edu.nps.moves.dis7.utilities.*; @@ -79,8 +79,7 @@ public class BoronPduReceiver //If PDU is an Entity State PDU, print location of entity if (currentPduType == ENTITY_STATE) { - EntityStatePdu espdu = new EntityStatePdu(); - espdu = (EntityStatePdu) pdu; + EntityStatePdu espdu = (EntityStatePdu) pdu; Vector3Double location = espdu.getEntityLocation(); System.out.println("Entity is at position: x = " + location.getX() + ", y = " + location.getY() + ", z = " + location.getZ()); diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduSender.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduSender.java index fccec68651b4c0828904846b2ad4afc72949e4b1..e22a07f0511d983951a3cace442f6625bbc3c1ab 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduSender.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Boron/BoronPduSender.java @@ -4,7 +4,7 @@ import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/BrennenstuhlEspduReceiver.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/BrennenstuhlEspduReceiver.java index 0d44068f66b9f46666dc2294bb3d687bf46e2b7f..7e9ad40f5b53e141acd427d5e403a8ddb033c85b 100755 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/BrennenstuhlEspduReceiver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/BrennenstuhlEspduReceiver.java @@ -4,7 +4,7 @@ import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.utilities.*; /** diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/BrennenstuhlEspduSender.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/BrennenstuhlEspduSender.java index 3adc6b233dc2c7a325ae846522deecb6385dc653..5f858f444529d16e5bc751d5556be77c286fe80b 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/BrennenstuhlEspduSender.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/BrennenstuhlEspduSender.java @@ -4,7 +4,7 @@ import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.utilities.*; import edu.nps.moves.dis7.enumerations.Country; import edu.nps.moves.dis7.enumerations.EntityKind; diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/Version2/AllPduReceiver.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/Version2/AllPduReceiver.java index 9fbb9159591ab4934fe2ede79a6a11a79dad894a..abe2879360309e629acfb4b8a78fba3139ca6320 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/Version2/AllPduReceiver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/Version2/AllPduReceiver.java @@ -1,9 +1,9 @@ -package MV3500Cohort2019JulySeptember.homework4.Brennenstuhl.test; +package MV3500Cohort2019JulySeptember.homework4.Brennenstuhl.Version2; import java.net.*; import java.io.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; import edu.nps.moves.dis7.utilities.*; import java.util.ArrayList; diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/Version2/AllPduSender.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/Version2/AllPduSender.java index a1607920c29d1843ec83854ee99368a7e301e8e9..7b79f2fdf33a7cda3109041224ad59d4f99dcd27 100755 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/Version2/AllPduSender.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Brennenstuhl/Version2/AllPduSender.java @@ -1,11 +1,10 @@ -package MV3500Cohort2019JulySeptember.homework4.Brennenstuhl.test; +package MV3500Cohort2019JulySeptember.homework4.Brennenstuhl.Version2; import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; -import edu.nps.moves.dis7.enumerations.*; +import edu.nps.moves.dis7.pdus.*; /** * This is an example that sends many/most types of PDUs. Useful for testing standards @@ -59,7 +58,7 @@ public class AllPduSender //*************************************************************************** CommentPdu newCommentPdu = new CommentPdu(); - ArrayList<VariableDatum> payloadList = new ArrayList<VariableDatum>(); + ArrayList<VariableDatum> payloadList = new ArrayList<>(); ArrayList<String> commentsList = new ArrayList<>(); commentsList.add("Hello CommentPDU"); diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Fetterolf/FetterolfPduListenerSaver.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Fetterolf/FetterolfPduListenerSaver.java index 2c7c6a144e43f29b9dc169e0bdc3907c84452a32..7f5baad906d83a3e9e4933faee96ad210303bc94 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Fetterolf/FetterolfPduListenerSaver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Fetterolf/FetterolfPduListenerSaver.java @@ -4,7 +4,7 @@ */ package MV3500Cohort2019JulySeptember.homework4.Fetterolf; -import edu.nps.moves.dis7.util.playerrecorder.Recorder; +import edu.nps.moves.dis7.utilities.stream.PduRecorder; import java.io.IOException; import java.util.Scanner; @@ -51,7 +51,7 @@ public class FetterolfPduListenerSaver { System.out.println("Beginning pdu save to directory " + outDir); try { - Recorder recorder = new Recorder(outDir, mcast, port); + PduRecorder recorder = new PduRecorder(outDir, mcast, port); recorder.startResume(); mystate state = mystate.RUNNING; @@ -76,7 +76,7 @@ public class FetterolfPduListenerSaver { break; } } - System.out.println("Ending pdu save to " + recorder.getLogFile()); + System.out.println("Ending pdu save to " + recorder.getLogFilePath()); } catch (IOException ex) { System.err.println("*** Exception: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage()); } diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Fetterolf/FetterolfPduReceiver.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Fetterolf/FetterolfPduReceiver.java index cf2f1e99151d6d5ff92d80e6ec8b24e39e834cff..703d3cc725ee1fb1c893d1d382300d5544481648 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Fetterolf/FetterolfPduReceiver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Fetterolf/FetterolfPduReceiver.java @@ -3,7 +3,7 @@ package MV3500Cohort2019JulySeptember.homework4.Fetterolf; import java.net.*; import java.io.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; import edu.nps.moves.dis7.utilities.*; import java.util.ArrayList; diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Fetterolf/FetterolfPduSender.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Fetterolf/FetterolfPduSender.java index af97291ed05ce19edf6172e52853261111f64bd2..cf4d9649f8bbdb49fac1d05f759ef68a4c6ea939 100755 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Fetterolf/FetterolfPduSender.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Fetterolf/FetterolfPduSender.java @@ -4,7 +4,7 @@ import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** @@ -104,7 +104,7 @@ public class FetterolfPduSender { // see Garrett Loffelman and Pete Severson's code for OpenDis version 4 example // https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/tree/master/assignments/src/MV3500Cohort2018JulySeptember/projects/LoeffelmanSeverson CommentPdu newCommentPdu = new CommentPdu(); - ArrayList<VariableDatum> payloadList = new ArrayList<VariableDatum>(); + ArrayList<VariableDatum> payloadList = new ArrayList<>(); ArrayList<String> commentsList = new ArrayList<>(); commentsList.add("Hello CommentPDU"); @@ -117,7 +117,7 @@ public class FetterolfPduSender { for (String comment : commentsList) { VariableDatum newVariableDatum = new VariableDatum(); newVariableDatum.setVariableDatumValue(comment.getBytes()); // conversion - newVariableDatum.setVariableDatumLength(comment.getBytes().length * 8); // bits, not bytes, see spec and javadoc + newVariableDatum.setVariableDatumLengthInBits(comment.getBytes().length * 8); // bits, not bytes, see spec and javadoc // alternatively, you do not need to set this and the marshaller will figure it out from the byte array // (see javadoc for VariableDatum.setVariableDatumLength()) payloadList.add(newVariableDatum); diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Knobeloch/Knobeloch_PduReceiver.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Knobeloch/Knobeloch_PduReceiver.java index b96efe5114e18826401bc8fca8d197f0498e6d8b..c062785c8bae2a4a2e40e06ed69c5729cb206518 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Knobeloch/Knobeloch_PduReceiver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Knobeloch/Knobeloch_PduReceiver.java @@ -3,7 +3,7 @@ package MV3500Cohort2019JulySeptember.homework4.Knobeloch; import java.net.*; import java.io.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; import edu.nps.moves.dis7.utilities.*; diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Knobeloch/Knobeloch_PduSender.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Knobeloch/Knobeloch_PduSender.java index ad0139b5dec0f91c10c5a012aa629e03794a9ff1..ca64e3c2c1b6b7a8254bb4d9f807436e9087a5cc 100755 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Knobeloch/Knobeloch_PduSender.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Knobeloch/Knobeloch_PduSender.java @@ -4,7 +4,7 @@ import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/McCann/McCannPduReceiver.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/McCann/McCannPduReceiver.java index c15faf1e83b7c82493dcfa5d9a1070c5e53d4cef..e3f076bc44a0b453ee3130af172a6c8a6c1f3bc0 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/McCann/McCannPduReceiver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/McCann/McCannPduReceiver.java @@ -3,7 +3,7 @@ package MV3500Cohort2019JulySeptember.homework4.McCann; import java.net.*; import java.io.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; import edu.nps.moves.dis7.utilities.*; import java.util.ArrayList; diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/McCann/McCannPduSender.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/McCann/McCannPduSender.java index 3585cf0cb28870d9f7ff841b314739c90c337fc5..91bb956b09ff7a04231d1b0499438c690dd54c63 100755 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/McCann/McCannPduSender.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/McCann/McCannPduSender.java @@ -4,7 +4,7 @@ import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** @@ -374,7 +374,7 @@ public class McCannPduSender // https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/tree/master/assignments/src/MV3500Cohort2018JulySeptember/projects/LoeffelmanSeverson CommentPdu newCommentPdu = new CommentPdu(); - ArrayList<VariableDatum> payloadList = new ArrayList<VariableDatum>(); + ArrayList<VariableDatum> payloadList = new ArrayList<>(); ArrayList<String> commentsList = new ArrayList<>(); commentsList.add("Hello CommentPDU"); @@ -387,7 +387,7 @@ public class McCannPduSender { VariableDatum newVariableDatum = new VariableDatum(); newVariableDatum.setVariableDatumValue (comment.getBytes()); // conversion - newVariableDatum.setVariableDatumLength(comment.getBytes().length * 8); // bits, not bytes, see spec and javadoc + newVariableDatum.setVariableDatumLengthInBits(comment.getBytes().length * 8); // bits, not bytes, see spec and javadoc // alternatively, you do not need to set this and the marshaller will figure it out from the byte array // (see javadoc for VariableDatum.setVariableDatumLength()) payloadList.add(newVariableDatum); diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Schutt/SchuttESPDUSender.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Schutt/SchuttESPDUSender.java index 02395f1f81c27890325b59e7dc5af8b99c32faf7..75912bbef4cbb96dd1b50431b08858a73b824bc4 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Schutt/SchuttESPDUSender.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Schutt/SchuttESPDUSender.java @@ -9,7 +9,7 @@ import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.utilities.*; import edu.nps.moves.dis7.enumerations.Country; import edu.nps.moves.dis7.enumerations.EntityKind; diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Schutt/SchuttEspduReceiver.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Schutt/SchuttEspduReceiver.java index 9343fb34e0c6c701fa376ae4dd0724bcdfe9abce..ef2c11e4e87e74722d0950bcfe3746b772178465 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Schutt/SchuttEspduReceiver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Schutt/SchuttEspduReceiver.java @@ -4,7 +4,7 @@ import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.utilities.*; /** diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Schutt/SchuttPDUSaverListener.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Schutt/SchuttPDUSaverListener.java index 32628ec6ac4e6f77be5ede876fd6638d1d241dd8..b4e9018c36866a4c67a4322d7ab2cdd28157954a 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Schutt/SchuttPDUSaverListener.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Schutt/SchuttPDUSaverListener.java @@ -4,7 +4,7 @@ * and open the template in the editor. */ package MV3500Cohort2019JulySeptember.homework4.Schutt; -import edu.nps.moves.dis7.util.playerrecorder.Recorder; +import edu.nps.moves.dis7.utilities.stream.PduRecorder; import java.io.IOException; import java.util.Scanner; @@ -53,7 +53,7 @@ public class SchuttPDUSaverListener System.out.println("Beginning pdu save to directory " + outDir); try { - Recorder recorder = new Recorder(outDir, mcast, port); + PduRecorder recorder = new PduRecorder(outDir, mcast, port); recorder.startResume(); mystate state = mystate.RUNNING; @@ -80,9 +80,9 @@ public class SchuttPDUSaverListener break; } } - System.out.println("Ending pdu save to "+recorder.getLogFile()); + System.out.println("Ending pdu save to "+recorder.getLogFilePath()); } - catch (IOException ex) { + catch (Exception ex) { System.err.println("*** Exception: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage()); } } diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduReceiver.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduReceiver.java index 6d7f7b6f1660b454ce60a5fc261079505ab19d5f..2783b68f3cdefe201ff525cc96f86036b7081b7c 100755 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduReceiver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduReceiver.java @@ -4,7 +4,7 @@ import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.utilities.*; /** diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduSender.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduSender.java index 45d005b3af5f817fc4bee65d93eca8674545a44f..3cd8c5befe8559adbd79f8f16912760eed08ff26 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduSender.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduSender.java @@ -4,11 +4,8 @@ import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.utilities.*; -import edu.nps.moves.dis7.enumerations.Country; -import edu.nps.moves.dis7.enumerations.EntityKind; -import edu.nps.moves.dis7.enumerations.PlatformDomain; /** * Creates and sends ESPDUs in IEEE binary format. Adapted from OpenDIS library diff --git a/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC1_MCAST_PduSender.java b/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC1_MCAST_PduSender.java index 88b3e29bda4c83342d0022a74edd097bc74b1b64..95c656c68133d0aa58de0c8f6c92523070af6a8a 100755 --- a/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC1_MCAST_PduSender.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC1_MCAST_PduSender.java @@ -5,7 +5,7 @@ import java.io.*; import java.net.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import java.util.logging.Level; import java.util.logging.Logger; @@ -94,7 +94,7 @@ public class BRE_KNO_MCC_PC1_MCAST_PduSender for (int i = 0; i < numbOfPDUs; i++) { CommentPdu newCommentPdu = new CommentPdu(); - ArrayList<VariableDatum> payloadList = new ArrayList<VariableDatum>(); + ArrayList<VariableDatum> payloadList = new ArrayList<>(); ArrayList<String> commentsList = new ArrayList<>(); newCommentPdu.setTimestamp((intervall * 5) + i ); diff --git a/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_Controller.java b/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_Controller.java index e1fe5cbfe32afa4a5aad588a49ac44a028daea7c..90e79875842cbdf435f748687ed8a3f5fd1af035 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_Controller.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_Controller.java @@ -1,6 +1,6 @@ package MV3500Cohort2019JulySeptember.projects.BrennenstuhlKnobelochMcCann; -import edu.nps.moves.dis7.Pdu; +import edu.nps.moves.dis7.pdus.Pdu; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.List; diff --git a/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_PC1_MCAST_PduReceiver.java b/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_PC1_MCAST_PduReceiver.java index ee513e773015a1e0e8bcfbbe129fc76715e950c2..e36e82cc707088545c70f4532f965cf2f88898f9 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_PC1_MCAST_PduReceiver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_PC1_MCAST_PduReceiver.java @@ -6,7 +6,7 @@ import com.sun.corba.se.impl.orbutil.concurrent.Mutex; // JDK 8 import java.net.*; import java.io.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; import edu.nps.moves.dis7.utilities.*; import java.util.ArrayList; diff --git a/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_PC3_UNICAST_PduReceiver.java b/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_PC3_UNICAST_PduReceiver.java index a0dffe5c75e42284e0b4bcf856d652b118b2d92d..5022ef29afda27a5ec7b9988c0ab51cabef7a743 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_PC3_UNICAST_PduReceiver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_PC3_UNICAST_PduReceiver.java @@ -13,6 +13,7 @@ public class BRE_KNO_MCC_PC2_PC3_UNICAST_PduReceiver extends Thread static int portPC3; + @Override public void run() { isRunning = true; diff --git a/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_PC3_UNICAST_PduSender.java b/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_PC3_UNICAST_PduSender.java index 87bc5b00219ba0bd3f18d45ec0556c5576490cb8..c69ab2a5ba32595c9ee1c0042fd3a4437a7bcd74 100755 --- a/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_PC3_UNICAST_PduSender.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC2_PC3_UNICAST_PduSender.java @@ -5,7 +5,7 @@ import com.sun.corba.se.impl.orbutil.concurrent.Mutex; // JDK 8 // maybe https://crunchify.com/what-is-java-semaphore-and-mutex-java-concurrency-multithread-explained-with-example/ import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.DISPDUType; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; @@ -27,6 +27,7 @@ public class BRE_KNO_MCC_PC2_PC3_UNICAST_PduSender extends Thread static InetAddress pc3IP; static int portPC3; + @Override public void run() { try diff --git a/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC3_PC2_UNICAST_PduReceiver.java b/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC3_PC2_UNICAST_PduReceiver.java index de2f52bf8fd7472793f92314d95cc7e05434d448..7f17d59ebb9724a65938a1897231ce8ba829eb0d 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC3_PC2_UNICAST_PduReceiver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/BRE_KNO_MCC_PC3_PC2_UNICAST_PduReceiver.java @@ -3,8 +3,8 @@ package MV3500Cohort2019JulySeptember.projects.BrennenstuhlKnobelochMcCann; import java.net.*; import java.io.*; -import edu.nps.moves.dis7.*; -import edu.nps.moves.dis7.util.PduFactory; +import edu.nps.moves.dis7.pdus.*; +import edu.nps.moves.dis7.utilities.PduFactory; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/assignments/src/MV3500Cohort2019JulySeptember/projects/SchuttFetterolf/AllPduRoundTripTest.java b/assignments/src/MV3500Cohort2019JulySeptember/projects/SchuttFetterolf/AllPduRoundTripTest.java index a81eb73c898e08a5fa3ac4ac568b50239ce83c8f..4149955944923fb712b91ee9ccbcbd9860725766 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/projects/SchuttFetterolf/AllPduRoundTripTest.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/projects/SchuttFetterolf/AllPduRoundTripTest.java @@ -22,7 +22,7 @@ //import com.google.common.io.Files; //import edu.nps.moves.dis7.enumerations.Country; //import edu.nps.moves.dis7.enumerations.DISPDUType; -//import edu.nps.moves.dis7.util.DisThreadedNetIF; +//import edu.nps.moves.dis7.util.DisThreadedNetworkInterface; //import edu.nps.moves.dis7.util.PduFactory; //import edu.nps.moves.dis7.util.playerrecorder.Player; //import edu.nps.moves.dis7.util.playerrecorder.Recorder; @@ -171,32 +171,32 @@ // private HashMap<DISPDUType, Pdu> pduReceivedMap = new HashMap<>(); // private HashMap<DISPDUType, Pdu> pduReadMap = new HashMap<>(); // -// DisThreadedNetIF disnetworking; +// DisThreadedNetworkInterface disNetworkInterface; // Recorder recorder; // // private void setupReceiver() // { -// disnetworking = new DisThreadedNetIF(); -// disnetworking.addListener(pdu -> { +// disNetworkInterface = new DisThreadedNetworkInterface(); +// disNetworkInterface.addListener(pdu -> { // pduReceivedMap.put(pdu.getPduType(), pdu); // }); // } // // private void shutDownReceiver() // { -// disnetworking.kill(); +// disNetworkInterface.kill(); // } // // private void sendOne(Pdu pdu) // { // pduSentMap.put(pdu.getPduType(), pdu); -// disnetworking.send(pdu); +// disNetworkInterface.send(pdu); // } // // private void setupRecorder() throws Exception // { // recorderDirectory = Files.createTempDir(); -// recorder = new Recorder(recorderDirectory.getAbsolutePath(), disnetworking.getMcastGroup(), disnetworking.getDisPort()); +// recorder = new Recorder(recorderDirectory.getAbsolutePath(), disNetworkInterface.getMcastGroup(), disNetworkInterface.getDisPort()); // System.out.println("Recorder log at " + recorderDirectory.getAbsolutePath()); // } // @@ -215,7 +215,7 @@ // private void getAllFromRecorder(Semaphore sem) throws Exception // { // sem.acquire(); -// Player player = new Player(disnetworking.getMcastGroup(), disnetworking.getDisPort(), recorderDirectory.toPath()); +// Player player = new Player(disNetworkInterface.getMcastGroup(), disNetworkInterface.getDisPort(), recorderDirectory.toPath()); // player.sendToNet(false); // player.addRawListener(ba -> { // if (ba != null) { diff --git a/assignments/src/MV3500Cohort2020JulySeptember/homework3/Mahan/README.md b/assignments/src/MV3500Cohort2020JulySeptember/homework3/Mahan/README.md index 0144d62d033fbe094ceac7a6d1bedc12d3c158b0..40200564c63ff03aa0328e08b2713cd80d252c3a 100644 --- a/assignments/src/MV3500Cohort2020JulySeptember/homework3/Mahan/README.md +++ b/assignments/src/MV3500Cohort2020JulySeptember/homework3/Mahan/README.md @@ -1,12 +1,8 @@ -## Homework 2: Multicast Networking -Modify this file to describe your project work. +This program uses UDP over ARGON.net +to connect with Chris Garibay's port and then +finds the modulo as being either true or false. +Just run the server and the corresponding receiver. +Also included are two screenshots to verify +send and receive capabilities. -Typical deliverables include properly packages source, execution log, and screen shots as appropriate. - -References include -* [README.md](../README.md) for this homework project. -* [README.md](../../../../README.md) for course assignments execution instructions. -* [assignments source subdirectories](../../../../../assignments/src) show examples from previous cohorts. - -Questions and innovation are always welcome, good luck! diff --git a/assignments/src/MV3500Cohort2020JulySeptember/homework3/Weissenberger/README.md b/assignments/src/MV3500Cohort2020JulySeptember/homework3/Weissenberger/README.md index 0144d62d033fbe094ceac7a6d1bedc12d3c158b0..3ec21e2b976a5937ab94a80cb4028ccb79441eae 100644 --- a/assignments/src/MV3500Cohort2020JulySeptember/homework3/Weissenberger/README.md +++ b/assignments/src/MV3500Cohort2020JulySeptember/homework3/Weissenberger/README.md @@ -10,3 +10,30 @@ References include * [assignments source subdirectories](../../../../../assignments/src) show examples from previous cohorts. Questions and innovation are always welcome, good luck! + + + +************************************************** +Project for HW #3 +Team: "Germany" (Stefan and Bernd) +************************************************** + + + +This program(s) do(es) the following: +- send two numbers, a mathematical operator and a port number over VPN to a TCP receiver +- the TCP receiver calculates the result and send it back to the sender over VPN using UDP! +- the UDP receiver shows the result + +The main focus was to send via TCP over a VPN, do something and send the result back via UDP. + +How to run the project: +0. connect both computer with the argon net +1. run UDPResultReceiver on Bernd's computer +2. run TCPNumberReceiverUDPResultSender on Stefan's computer +3. find Stefan's IP within the argon net +4. change the TCP_ARGON_SERVER_IP in class TCPNumberSender to Stefan's IP. +5. run TCPNumberSender + +(you can edit the numbers and run TCPNumberSender multiple times...) + diff --git a/assignments/src/MV3500Cohort2020JulySeptember/homework4/Goericke/README.md b/assignments/src/MV3500Cohort2020JulySeptember/homework4/Goericke/README.md deleted file mode 100644 index 0144d62d033fbe094ceac7a6d1bedc12d3c158b0..0000000000000000000000000000000000000000 --- a/assignments/src/MV3500Cohort2020JulySeptember/homework4/Goericke/README.md +++ /dev/null @@ -1,12 +0,0 @@ -## Homework 2: Multicast Networking - -Modify this file to describe your project work. - -Typical deliverables include properly packages source, execution log, and screen shots as appropriate. - -References include -* [README.md](../README.md) for this homework project. -* [README.md](../../../../README.md) for course assignments execution instructions. -* [assignments source subdirectories](../../../../../assignments/src) show examples from previous cohorts. - -Questions and innovation are always welcome, good luck! diff --git a/assignments/src/MV3500Cohort2020JulySeptember/homework4/Weissenberger/README.md b/assignments/src/MV3500Cohort2020JulySeptember/homework4/Weissenberger/README.md deleted file mode 100644 index 0144d62d033fbe094ceac7a6d1bedc12d3c158b0..0000000000000000000000000000000000000000 --- a/assignments/src/MV3500Cohort2020JulySeptember/homework4/Weissenberger/README.md +++ /dev/null @@ -1,12 +0,0 @@ -## Homework 2: Multicast Networking - -Modify this file to describe your project work. - -Typical deliverables include properly packages source, execution log, and screen shots as appropriate. - -References include -* [README.md](../README.md) for this homework project. -* [README.md](../../../../README.md) for course assignments execution instructions. -* [assignments source subdirectories](../../../../../assignments/src) show examples from previous cohorts. - -Questions and innovation are always welcome, good luck! diff --git a/assignments/src/MV3500Cohort2020JulySeptember/homework4/WeissenbergerGoericke/TCPReceiverVPNBridge.java b/assignments/src/MV3500Cohort2020JulySeptember/homework4/WeissenbergerGoericke/TCPReceiverVPNBridge.java index 43a014be20109e9c245bb84136253d0995e10c67..9c051f935efe94615f9c3102a73ba91f095caeac 100644 --- a/assignments/src/MV3500Cohort2020JulySeptember/homework4/WeissenbergerGoericke/TCPReceiverVPNBridge.java +++ b/assignments/src/MV3500Cohort2020JulySeptember/homework4/WeissenbergerGoericke/TCPReceiverVPNBridge.java @@ -1,5 +1,5 @@ -package MV3500Cohort2020JulySeptember.homework4.Weissenberger; +package MV3500Cohort2020JulySeptember.homework4.WeissenbergerGoericke; import java.io.IOException; import java.io.OutputStream; diff --git a/assignments/src/MV3500Cohort2020JulySeptember/homework4/WeissenbergerGoericke/TcpServerForFinal.java b/assignments/src/MV3500Cohort2020JulySeptember/homework4/WeissenbergerGoericke/TcpServerForFinal.java index 5e7066c139149084e89bd0cae45237e550476ddf..f7a8082ede0b933c2927c45b470ebe83394c4f9a 100644 --- a/assignments/src/MV3500Cohort2020JulySeptember/homework4/WeissenbergerGoericke/TcpServerForFinal.java +++ b/assignments/src/MV3500Cohort2020JulySeptember/homework4/WeissenbergerGoericke/TcpServerForFinal.java @@ -1,4 +1,4 @@ -package MV3500Cohort2020JulySeptember.homework4.Weissenberger; +package MV3500Cohort2020JulySeptember.homework4.WeissenbergerGoericke; import java.io.*; import java.net.*; @@ -24,6 +24,9 @@ import java.net.*; */ public class TcpServerForFinal { + public static final String DEST_INET_AD = "127.0.0.1"; + public static final String LOCAL_WIFI_INET = "192.168.188.106"; + public static void main(String[] args) { try { @@ -33,7 +36,7 @@ public class TcpServerForFinal { System.out.println("TcpExample3Server has started..."); // it helps debugging to put this on console first //ServerSocket serverSocket = new ServerSocket(2317); - InetAddress[] ia = InetAddress.getAllByName("192.168.188.106"); + InetAddress[] ia = InetAddress.getAllByName(LOCAL_WIFI_INET); for (int i = 0;i < ia.length; i++){ System.out.println("---: "+ia[i]); } @@ -78,6 +81,7 @@ public class TcpServerForFinal { System.out.println("TcpExample3Server socket pair showing host name, address, port:"); } + sendResultViaUDP(serverMessage); } } catch (IOException e) { System.err.println("Problem with TcpExample3Server networking: " + e); @@ -88,4 +92,61 @@ public class TcpServerForFinal { } } } + + /** + * send the result to Stefan 2x + * @param result + * @param inetAddress Stefans's IP + * @param port Stefans's UDP port number + * @throws IOException + */ + private static void sendResultViaUDP(String result) throws IOException{ + DatagramSocket udpSocket = null; + DataOutputStream dos = null; + + try + { + // Create a UDP socket + udpSocket = new DatagramSocket(); // let system assign output port, then SENDING_PORT not needed + + // Put together a message with binary content. "ByteArrayOutputStream" + // is a java.io utility that lets us put together an array of binary + // data, which we put into the UDP packet. + + ByteArrayOutputStream baos = new ByteArrayOutputStream(1500); // how many bytes are in buffer? MTU=1500 is good + dos = new DataOutputStream(baos); // wrapper for writing values, connects both streams + + // Put together a packet to send + // these types and order of variables must match on sender and receiver + byte[] byteArray = baos.toByteArray(); + InetAddress destinationAddress = InetAddress.getByName(DEST_INET_AD); + DatagramPacket datagramPacket = new DatagramPacket(byteArray, byteArray.length, destinationAddress, 1415); + + for (int index = 1; index <= 2; index++) + { + dos.writeUTF (result); + dos.flush(); // sends DataOutputStream to ByteArrayOutputStream + byteArray = baos.toByteArray(); // OK so go get the flushed result... + datagramPacket.setData(byteArray); // and put it in the packet... + udpSocket.send(datagramPacket); // and send it away. boom gone, nonblocking. + + Thread.sleep(1000); // Send packets at rate of one per second + baos.reset(); // clear the output stream after sending + } + dos.close(); + } + catch (IOException | InterruptedException e) + { + System.err.println("Problem with UdpSender, see exception trace:"); + System.err.println(e); + } + finally // clean up prior to exit, don't want to leave behind zombies + { + if (udpSocket != null) + udpSocket.close(); + + if (dos != null) + dos.close(); + } + } } diff --git a/assignments/src/MV3500Cohort2020JulySeptember/homework4/WeissenbergerGoericke/UDPResultReceiver.java b/assignments/src/MV3500Cohort2020JulySeptember/homework4/WeissenbergerGoericke/UDPResultReceiver.java new file mode 100644 index 0000000000000000000000000000000000000000..36390f308218cd8d9d9b43b2a0b9b120e5321922 --- /dev/null +++ b/assignments/src/MV3500Cohort2020JulySeptember/homework4/WeissenbergerGoericke/UDPResultReceiver.java @@ -0,0 +1,71 @@ + +package MV3500Cohort2020JulySeptember.homework4.Weissenberger; + +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; + +/** + * This class will be connected by an UDP sender over VPN (argon) + * @date 09/02/2020 + * @author Loki + * @group Weissenberger/Goericke + */ +public class UDPResultReceiver { + + public static final int RECEIVING_PORT = 1415; + + /** + * @param args the command line arguments + * @throws java.io.IOException + */ + public static void main(String[] args) throws IOException + { + DatagramSocket udpSocket = null; + + try + { + System.out.println(UDPResultReceiver.class.getName() + " started..."); + + // Create a UDP socket + udpSocket = new DatagramSocket(RECEIVING_PORT); + udpSocket.setReceiveBufferSize(1500); // how many bytes are in buffer? MTU=1500 is good + udpSocket.setBroadcast(false); // we're just receiving here + + byte[] byteArray = new byte[1500]; + DatagramPacket receivePacket = new DatagramPacket(byteArray, byteArray.length); + + ByteArrayInputStream bais = new ByteArrayInputStream(byteArray); + DataInputStream dis = new DataInputStream(bais); + + String received; + + // You need a new receiving packet to read from every packet received + while (true) + { + udpSocket.receive(receivePacket); // blocks until packet is received + + received = dis.readUTF(); + + dis.reset(); // now clear the input stream after reading, in preparation for next loop + + System.out.println("Received from Bernd: "+received); + + } + } + catch(IOException e) + { + System.err.println("Problem with UdpReceiver, see exception trace:"); + System.err.println(e); + } + finally // clean up prior to exit, don't want to leave behind zombie socket + { + if (udpSocket != null) + udpSocket.close(); + System.out.println(UDPResultReceiver.class.getName() + " complete."); // all done + } + } + +} diff --git a/build.xml b/build.xml index b48845a177f86db43b55a53aa1384f4e273d42d9..d794938d6c2791d0d8189ee423e9aa303f019220 100644 --- a/build.xml +++ b/build.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 1995-2019 held by the author(s). All rights reserved. + Copyright (c) 1995-2020 held by the author(s). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -39,7 +39,7 @@ POSSIBILITY OF SUCH DAMAGE. Author : Don Brutzman and Don McGregor Description: Ant build.xml file for Networked Graphics MV3500 --> -<project name="Networked_Graphics_MV3500" default="all" basedir="."> +<project name="MV3500 Networked Graphics" default="all" basedir="."> <description>Build targets for NPS Networked Graphics MV3500</description> <!-- TODO add targets for project maintenance, testing and deployment @@ -84,22 +84,48 @@ POSSIBILITY OF SUCH DAMAGE. <nbbrowse url="https://github.com/open-dis"/> </target> - <target name="update.open-dis7.jar.local" description="update open-dis7.jar in project lib directory"> - <!-- TODO get clearer about what each of 4 jar files might be --> - <property name="open-dis7-java.relative" value="../open-dis7-java/dist"/> - <echo message="copy ${open-dis7-java.relative}/open-dis7-java.jar to project lib/ subdirectory"/> + <target name="update.open-dis7.jar.local" description="update open-dis7-java jar files from locally built project into lib directory"> + + <property name="open-dis7-java.relative" value="../../x3d-github/open-dis7-java/dist"/> + <echo message="copy ${open-dis7-java.relative}/open-dis7-java.jar and related jar files to project lib/ subdirectory"/> <!-- https://ant.apache.org/manual/Tasks/fail.html --> - <fail message="open-dis7-java.jar not found"> + <fail message="open-dis7-enumerations-classes.jar not found"> <condition> <not> <resourcecount count="1"> - <fileset id="fs" dir="${open-dis7-java.relative}" includes="open-dis7-java.jar"/><!-- comma separated --> + <fileset id="fs" dir="${open-dis7-java.relative}" includes="open-dis7-enumerations-classes.jar"/><!-- comma separated --> </resourcecount> </not> </condition> </fail> - <delete file="lib/open-dis7-java.jar" verbose="true" /> - <copy file="${open-dis7-java.relative}/open-dis7-java.jar" todir="lib" force="true" verbose="true" failonerror="true"/> + <delete file="lib/open-dis7-enumerations-classes.jar" verbose="true" failonerror="false"/> + <delete file="lib/open-dis7-enumerations-javadoc.jar" verbose="true" failonerror="false"/> + <delete file="lib/open-dis7-enumerations-source.jar" verbose="true" failonerror="false"/> + + <copy file="${open-dis7-java.relative}/open-dis7-enumerations-classes.jar" todir="lib" force="true" verbose="true" failonerror="true"/> + <copy file="${open-dis7-java.relative}/open-dis7-enumerations-source.jar" todir="lib" force="true" verbose="true" failonerror="true"/> + <copy file="${open-dis7-java.relative}/open-dis7-enumerations-javadoc.jar" todir="lib" force="true" verbose="true" failonerror="true"/> + + <fail message="open-dis7-pdus-classes.jar not found"> + <condition> + <not> + <resourcecount count="1"> + <fileset id="fs" dir="${open-dis7-java.relative}" includes="open-dis7-pdus-classes.jar"/><!-- comma separated --> + </resourcecount> + </not> + </condition> + </fail> + <delete file="lib/open-dis7-classes.jar" verbose="true" failonerror="false"/><!-- prior name --> + <delete file="lib/open-dis7-javadoc.jar" verbose="true" failonerror="false"/><!-- prior name --> + <delete file="lib/open-dis7-source.jar" verbose="true" failonerror="false"/><!-- prior name --> + + <delete file="lib/open-dis7-pdus-classes.jar" verbose="true" failonerror="false"/> + <delete file="lib/open-dis7-pdus-javadoc.jar" verbose="true" failonerror="false"/> + <delete file="lib/open-dis7-pdus-source.jar" verbose="true" failonerror="false"/> + + <copy file="${open-dis7-java.relative}/open-dis7-pdus-classes.jar" todir="lib" force="true" verbose="true" failonerror="true"/> + <copy file="${open-dis7-java.relative}/open-dis7-pdus-javadoc.jar" todir="lib" force="true" verbose="true" failonerror="true"/> + <copy file="${open-dis7-java.relative}/open-dis7-pdus-source.jar" todir="lib" force="true" verbose="true" failonerror="true"/> </target> <target name="update.open-dis7.jar.gitlab" description="update open-dis7.jar in project lib directory"> diff --git a/conferences/IITSEC2020/IITSEC2020_DIS_Tutorial_20031.pptx b/conferences/IITSEC2020/IITSEC2020_DIS_Tutorial_20031.pptx index c6bc50c3edec43270d6dfd1bf22073ec01831d65..303f5debe7d6ba92e0ba0842dc49ff2d2a954c43 100644 Binary files a/conferences/IITSEC2020/IITSEC2020_DIS_Tutorial_20031.pptx and b/conferences/IITSEC2020/IITSEC2020_DIS_Tutorial_20031.pptx differ diff --git a/examples/build.xml b/examples/build.xml index 78b29aff01d08f569be848887add3f7004143e54..65e2469d01f5930d5f9b688147cf14f4b590a729 100644 --- a/examples/build.xml +++ b/examples/build.xml @@ -8,7 +8,7 @@ <!-- You can turn off the Compile on Save (or Deploy on Save) setting --> <!-- in the project's Project Properties dialog box.--> -<project name="Networked_Graphics_MV3500_examples" default="default" basedir="."> +<project name="MV3500 examples" default="default" basedir="."> <description>Builds, tests, and runs the project Networked Graphics MV3500 examples.</description> <import file="nbproject/build-impl.xml"/> diff --git a/examples/nbproject/build-impl.xml b/examples/nbproject/build-impl.xml index a597975468383822a61c2c6b556867585e301696..08f4fec2a5ed8aecef43418dff61d54eb2b890ea 100644 --- a/examples/nbproject/build-impl.xml +++ b/examples/nbproject/build-impl.xml @@ -154,18 +154,6 @@ is divided into following sections: <istrue value="${not.archive.disabled}"/> </or> </condition> - <condition property="do.mkdist"> - <and> - <isset property="do.archive"/> - <isset property="libs.CopyLibs.classpath"/> - <not> - <istrue value="${mkdist.disabled}"/> - </not> - <not> - <istrue value="${modules.supported.internal}"/> - </not> - </and> - </condition> <condition property="do.archive+manifest.available"> <and> <isset property="manifest.available"/> @@ -379,11 +367,7 @@ is divided into following sections: <compilerarg value="-s"/> <compilerarg path="@{apgeneratedsrcdir}"/> <compilerarg line="${ap.proc.none.internal}"/> - <customize/>> - <compilerarg value="-Xlint:all"/> - <!-- http://ant.apache.org/manual/Tasks/javac.html#bootstrap --> - <!-- https://stackoverflow.com/questions/4134803/ant-passing-compilerarg-into-javac --> - <compilerarg value="-Xbootclasspath/p:${toString:lib.path.ref}"/> + <customize/> </javac> </sequential> </macrodef> @@ -427,9 +411,6 @@ is divided into following sections: <compilerarg path="@{apgeneratedsrcdir}"/> <compilerarg line="${ap.proc.none.internal}"/> <customize/> - <!-- http://ant.apache.org/manual/Tasks/javac.html#bootstrap --> - <!-- https://stackoverflow.com/questions/4134803/ant-passing-compilerarg-into-javac --> - <compilerarg value="-Xbootclasspath/p:${toString:lib.path.ref}"/> </javac> </sequential> </macrodef> @@ -465,9 +446,6 @@ is divided into following sections: <compilerarg line="${javac.profile.cmd.line.arg}"/> <compilerarg line="${javac.compilerargs}"/> <customize/> - <!-- http://ant.apache.org/manual/Tasks/javac.html#bootstrap --> - <!-- https://stackoverflow.com/questions/4134803/ant-passing-compilerarg-into-javac --> - <compilerarg value="-Xbootclasspath/p:${toString:lib.path.ref}"/> </javac> </sequential> </macrodef> @@ -1193,13 +1171,27 @@ is divided into following sections: <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> </manifest> </target> - <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs"> + <target depends="init,compile" name="-check-do-mkdist"> + <condition property="do.mkdist"> + <and> + <isset property="do.archive"/> + <isset property="libs.CopyLibs.classpath"/> + <not> + <istrue value="${mkdist.disabled}"/> + </not> + <not> + <available file="${build.classes.dir}/module-info.class"/> + </not> + </and> + </condition> + </target> + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-check-do-mkdist" if="do.mkdist" name="-do-jar-copylibs"> <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> <echo level="info">To run this application from the command line without Ant, try:</echo> <property location="${dist.jar}" name="dist.jar.resolved"/> <echo level="info">java -jar "${dist.jar.resolved}"</echo> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-check-do-mkdist" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> <j2seproject1:jar manifest="${tmp.manifest.file}"/> <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> <property location="${dist.jar}" name="dist.jar.resolved"/> diff --git a/examples/nbproject/project.properties b/examples/nbproject/project.properties index a7dc2db7ef8fef792b98ddfcdb28836db1d71427..690147e112a254f9104c5c4e96bd6c41854ff3d9 100644 --- a/examples/nbproject/project.properties +++ b/examples/nbproject/project.properties @@ -1,108 +1,107 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=Networked Graphics MV3500 examples -application.vendor=don -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.modulepath=\ - ${run.modulepath} -debug.test.classpath=\ - ${run.test.classpath} -debug.test.modulepath=\ - ${run.test.modulepath} -# Files in build.classes.dir which should be excluded from distribution jar -dist.archive.excludes= -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/Networked_Graphics_MV3500_examples.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -file.reference.commons-io-2.6.jar=../lib/commons-io-2.6.jar -file.reference.dis-enums-1.3.jar=../lib/dis-enums-1.3.jar -file.reference.guava-28.0-jre.jar=../lib/guava-28.0-jre.jar -file.reference.open-dis7-entities-all.jar=../lib/open-dis7-entities-all.jar -file.reference.open-dis7-java.jar=../lib/open-dis7-java.jar -file.reference.open-dis7-javadoc.jar=../lib/open-dis7-javadoc.jar -file.reference.open-dis7-source.jar=../lib/open-dis7-source.jar -file.reference.open-dis_4.16.jar=../lib/open-dis_4.16.jar -includes=** -jar.compress=false -javac.classpath=\ - ${file.reference.open-dis7-entities-all.jar}:\ - ${file.reference.open-dis7-java.jar}:\ - ${file.reference.open-dis7-javadoc.jar}:\ - ${file.reference.open-dis7-source.jar}:\ - ${file.reference.commons-io-2.6.jar}:\ - ${file.reference.guava-28.0-jre.jar}:\ - ${file.reference.open-dis_4.16.jar}:\ - ${file.reference.dis-enums-1.3.jar} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.external.vm=true -javac.modulepath= -javac.processormodulepath= -javac.processorpath=\ - ${javac.classpath} -javac.source=1.8 -javac.target=1.8 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.modulepath=\ - ${javac.modulepath} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.html5=false -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.reference.open-dis7-java.jar=../lib/open-dis7-javadoc.jar -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -jlink.launcher=false -jlink.launcher.name=Networked_Graphics_MV3500_examples -main.class=TcpExamples.TcpExample1Telnet -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false -platform.active=default_platform -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project. -# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. -# To set system properties for unit tests define test-sys-prop.name=value: -run.jvmargs= -run.modulepath=\ - ${javac.modulepath} -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -run.test.modulepath=\ - ${javac.test.modulepath} -source.encoding=UTF-8 -source.reference.open-dis7-java.jar=../lib/open-dis7-source.jar -src.dir=src +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.desc=Example programs provided as part of NPS course Networked Graphics MV3500. This course is an introduction to network communications in simulation applications. Topics include an introduction to the TCP/IP protocol stack; TCP/IP socket communications, including TCP, UDP, and multicast; and protocol design issues, with emphasis on Distributed Interactive Simulation (DIS) Protocol and High Level Architecture (HLA). Course emphasis is on creation and testing of network programming network code and web-browser applications. +application.homepage=https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/examples +application.splash=..\\..\\NetworkedGraphicsMV3500\\documentation\\images\\OpenDisSurferDude.png +application.title=NPS Networked Graphics MV3500 examples +application.vendor=Don Brutzman +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.modulepath=\ + ${run.modulepath} +debug.test.classpath=\ + ${run.test.classpath} +debug.test.modulepath=\ + ${run.test.modulepath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/Networked_Graphics_MV3500_examples.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.commons-io-2.6.jar=../lib/commons-io-2.6.jar +file.reference.dis-enums-1.3.jar=../lib/dis-enums-1.3.jar +file.reference.guava-28.0-jre.jar=../lib/guava-28.0-jre.jar +file.reference.open-dis7-enumerations-classes.jar=../lib/open-dis7-enumerations-classes.jar +file.reference.open-dis7-pdus-classes.jar=../lib/open-dis7-pdus-classes.jar +file.reference.open-dis_4.16.jar=../lib/open-dis_4.16.jar +includes=** +jar.compress=false +javac.classpath=\ + ${file.reference.open-dis7-enumerations-classes.jar}:\ + ${file.reference.open-dis7-pdus-classes.jar}:\ + ${file.reference.commons-io-2.6.jar}:\ + ${file.reference.guava-28.0-jre.jar}:\ + ${file.reference.open-dis_4.16.jar}:\ + ${file.reference.dis-enums-1.3.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.modulepath= +javac.processormodulepath= +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.modulepath=\ + ${javac.modulepath} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=true +javadoc.encoding=${source.encoding} +javadoc.html5=false +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.reference.open-dis7-enumerations-classes.jar=../lib/open-dis7-enumerations-javadoc.jar +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle=NPS Networked Graphics MV3500 Examples +jlink.launcher=false +jlink.launcher.name=Networked_Graphics_MV3500_examples +main.class=TcpExamples.TcpExample1Telnet +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.modulepath=\ + ${javac.modulepath} +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +run.test.modulepath=\ + ${javac.test.modulepath} +source.encoding=UTF-8 +source.reference.open-dis7-enumerations-classes.jar=../lib/open-dis7-enumerations-source.jar +src.dir=src diff --git a/examples/nbproject/project.xml b/examples/nbproject/project.xml index 58b9ae9e8aa001602af580934ab76e3b3120d5fc..17777b64b50917288d0955fa040b8ad779b80be8 100644 --- a/examples/nbproject/project.xml +++ b/examples/nbproject/project.xml @@ -12,7 +12,9 @@ <spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1"> <word>classpath</word> <word>CourseExamples</word> + <word>deserialization</word> <word>localhost</word> + <word>marshalling</word> <word>multicast</word> <word>Netbeans</word> <word>netcat</word> diff --git a/examples/src/HttpServletExamples/HttpWebPageSource.java b/examples/src/HttpServletExamples/HttpWebPageSource.java index d97e81ef3eba699d7b58f1fdecdca8b4874c2fc6..97166ba5a0593ae53b1276d4e4377f454281d2cc 100644 --- a/examples/src/HttpServletExamples/HttpWebPageSource.java +++ b/examples/src/HttpServletExamples/HttpWebPageSource.java @@ -27,11 +27,12 @@ public class HttpWebPageSource { // We request an IP to connect to a web server running on default http port 80. - String WEB_SERVER_ADDRESS = "www.nps.edu"; - int WEB_SERVER_PORT_HTTP =80; - int WEB_SERVER_PORT_HTTPS =443; + String WEB_SERVER_ADDRESS = "www.nps.edu"; + int WEB_SERVER_PORT_HTTP = 80; + int WEB_SERVER_PORT_HTTPS = 443; // does this work too? System.out.println("New socket WEB_ADDRESS=" + WEB_SERVER_ADDRESS); + // this Java construct will work for HTTP but not HTTPS Socket socket = new Socket(WEB_SERVER_ADDRESS, WEB_SERVER_PORT_HTTPS); // compare alternative: https on port 443 // we send a command to the web server, asking for what @@ -55,9 +56,9 @@ public class HttpWebPageSource { // But a web server will write an unknown number of lines. // So now we read until the transmisson ends. - InputStream is = socket.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - BufferedReader br = new BufferedReader(isr); + InputStream is = socket.getInputStream(); + Reader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); String line; int count = 0; @@ -71,8 +72,8 @@ public class HttpWebPageSource { } catch(IOException e) { - System.out.println("HttpWebPageSource: problem with client"); - System.out.println(e); + System.err.println("HttpWebPageSource: problem with client"); + System.err.println(e); } } } diff --git a/examples/src/HttpServletExamples/HttpWebPageSourceTerminalLog.txt b/examples/src/HttpServletExamples/HttpWebPageSourceTerminalLog.txt index 896fb30c8a6329cb407929eec9a835ac16839a6d..9deeef11d9aede321dc7ed17c0795449fbb134d7 100644 --- a/examples/src/HttpServletExamples/HttpWebPageSourceTerminalLog.txt +++ b/examples/src/HttpServletExamples/HttpWebPageSourceTerminalLog.txt @@ -31,3 +31,34 @@ GET /index.html HTTP/1.0 15: </body></html> HttpWebPageSource: response finished BUILD SUCCESSFUL (total time: 2 seconds) + +now using https to port 443: + +run-single: +HttpWebPageSource: create http connection and retrieve default page +Reference: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol +Reference: https://tools.ietf.org/html/rfc7230 +Reference: https://en.wikipedia.org/wiki/CURL + +New socket WEB_ADDRESS=www.nps.edu +GET /index.html HTTP/1.0 + +1: HTTP/1.1 400 Bad Request +2: Date: Mon, 17 Aug 2020 18:25:20 GMT +3: Server: Apache +4: Content-Length: 362 +5: Connection: close +6: Content-Type: text/html; charset=iso-8859-1 +7: +8: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> +9: <html><head> +10: <title>400 Bad Request</title> +11: </head><body> +12: <h1>Bad Request</h1> +13: <p>Your browser sent a request that this server could not understand.<br /> +14: Reason: You're speaking plain HTTP to an SSL-enabled server port.<br /> +15: Instead use the HTTPS scheme to access this URL, please.<br /> +16: </p> +17: </body></html> +HttpWebPageSource: response finished +BUILD SUCCESSFUL (total time: 2 seconds) diff --git a/examples/src/OpenDis4Examples/EspduReceiver.java b/examples/src/OpenDis4Examples/EspduReceiver.java index 036477c953c41cf14a02136981a4c4275e9c651a..d34a6d60bbad03fba7e9a7b4db4755547014d3fb 100644 --- a/examples/src/OpenDis4Examples/EspduReceiver.java +++ b/examples/src/OpenDis4Examples/EspduReceiver.java @@ -30,7 +30,7 @@ public class EspduReceiver public static void main(String args[]) { - System.out.println("DisExamples.EspduReceiver started..."); + System.out.println("OpenDis4Examples.EspduReceiver started..."); MulticastSocket socket; DatagramPacket packet; @@ -75,7 +75,7 @@ public class EspduReceiver } // End try catch (IOException e) { - System.out.println("Problem with DisExamples.EspduReceiver, see exception trace:"); + System.out.println("Problem with OpenDis4Examples.EspduReceiver, see exception trace:"); System.out.println(e); } } // end main diff --git a/examples/src/OpenDis4Examples/EspduSender.java b/examples/src/OpenDis4Examples/EspduSender.java index 078cd1b3399633589b67ab38d4bada72fc28b3fb..dd0c8eeec4164f60ca5a2b83998ab411d5a6a22b 100644 --- a/examples/src/OpenDis4Examples/EspduSender.java +++ b/examples/src/OpenDis4Examples/EspduSender.java @@ -45,7 +45,7 @@ public class EspduSender { */ public static void main(String args[]) { - System.out.println("DisExamples.EspduSender started... send " + NUMBER_TO_SEND + " ESPDUs, initial index=0"); + System.out.println("OpenDis4Examples.EspduSender started... send " + NUMBER_TO_SEND + " ESPDUs, initial index=0"); /** * an entity state pdu */ @@ -263,7 +263,7 @@ public class EspduSender { } catch (IOException | InterruptedException e) { - System.out.println("Problem with DisExamples.EspduSender, see exception trace:"); + System.out.println("Problem with OpenDis4Examples.EspduSender, see exception trace:"); System.out.println(e); } } @@ -315,7 +315,7 @@ public class EspduSender { } catch (SocketException e) { - System.out.println("Problem with DisExamples.EspduSender.getBroadcastAddresses(), see exception trace:"); + System.out.println("Problem with OpenDis4Examples.EspduSender.getBroadcastAddresses(), see exception trace:"); System.out.println(e); } return broadcastAddresses; diff --git a/examples/src/OpenDis4Examples/PduReceiver.java b/examples/src/OpenDis4Examples/PduReceiver.java index 77923859df15cb83b5fa61e2189ccb765ef2f1fb..ab7161154619af3dc3588d28659188cc4a8bd71a 100644 --- a/examples/src/OpenDis4Examples/PduReceiver.java +++ b/examples/src/OpenDis4Examples/PduReceiver.java @@ -23,7 +23,7 @@ public class PduReceiver try { - System.out.println("DisExamples.PduReceiver started..."); + System.out.println("OpenDis4Examples.PduReceiver started..."); socket = new MulticastSocket (MULTICAST_PORT); address = InetAddress.getByName(MULTICAST_GROUP); socket.joinGroup(address); @@ -61,12 +61,12 @@ public class PduReceiver } catch (IOException e) { - System.out.println("Problem with DisExamples.PduReceiver, see exception trace:"); + System.out.println("Problem with OpenDis4Examples.PduReceiver, see exception trace:"); System.out.println(e); } finally { - System.out.println("DisExamples.PduReceiver complete."); + System.out.println("OpenDis4Examples.PduReceiver complete."); } } } diff --git a/examples/src/OpenDis4Examples/PduSender.java b/examples/src/OpenDis4Examples/PduSender.java index 63b17f128756e2422f70137a5c58fdc0e6d4bae5..6767f24044f4ead5bffcaf01217c126c23b1f321 100644 --- a/examples/src/OpenDis4Examples/PduSender.java +++ b/examples/src/OpenDis4Examples/PduSender.java @@ -44,7 +44,7 @@ public class PduSender public void run() { - System.out.println("DisExamples.PduSender started..."); + System.out.println("OpenDis4Examples.PduSender started..."); try { List<Pdu> generatedPdusList = new ArrayList<>(); diff --git a/examples/src/OpenDis7Examples/AllPduReceiver.java b/examples/src/OpenDis7Examples/AllPduReceiver.java index c2ad0f3b89eeeddbf8522d69587640ff2a9b58ee..fca670c79803bdb31e81bcdf6569dd3b4f93e135 100644 --- a/examples/src/OpenDis7Examples/AllPduReceiver.java +++ b/examples/src/OpenDis7Examples/AllPduReceiver.java @@ -3,15 +3,15 @@ package OpenDis7Examples; import java.net.*; import java.io.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; import edu.nps.moves.dis7.utilities.PduFactory; import java.util.ArrayList; public class AllPduReceiver { - public static final int DEFAULT_MULTICAST_PORT = AllPduSender.DEFAULT_MULTICAST_PORT; public static final String DEFAULT_MULTICAST_ADDRESS = AllPduSender.DEFAULT_MULTICAST_ADDRESS; + public static final int DEFAULT_MULTICAST_PORT = AllPduSender.DEFAULT_MULTICAST_PORT; public static final boolean USE_FAST_ESPDU = false; public static void main(String args[]) @@ -22,14 +22,14 @@ public class AllPduReceiver DatagramPacket packet; try { - System.out.println("DisExamplesOpenDis7.AllPduReceiver started..."); + System.out.println("OpenDis7Examples.AllPduReceiver started..."); if (args.length == 2) { - socket = new MulticastSocket(Integer.parseInt(args[0])); - address = InetAddress.getByName(args[1]); + address = InetAddress.getByName(args[0]); + socket = new MulticastSocket(Integer.parseInt(args[1])); } else { - System.out.println("Usage: AllPduReceiver <port> <multicast group>"); - System.out.println("Default: AllPduReceiver " + DEFAULT_MULTICAST_PORT + " " + DEFAULT_MULTICAST_ADDRESS); + 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); } @@ -45,7 +45,7 @@ public class AllPduReceiver socket.receive(packet); - Pdu pdu = factory.createPdu(packet.getData()); + Pdu pdu = factory.createPdu(packet.getData()); // packet.getData() returns byte[] array data buffer if (pdu != null) { DISPDUType currentPduType = pdu.getPduType(); //short currentPduType = pdu.getPduType(); @@ -54,16 +54,16 @@ public class AllPduReceiver String currentPduFamilyName = pdu.getClass().getSuperclass().getSimpleName(); StringBuilder message = new StringBuilder(); + message.append(DisTime.timeStampToString(pdu.getTimestamp()) + " "); 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(currentPduType.getValue()); - String currentPduTypePadded = String.format("%-34s", currentPduType); // - indicates right padding of whitespace - message.append(" " ).append(currentPduTypePadded); - String currentPduTypeNamePadded = String.format("%-49s", currentPduTypeName); // - indicates right padding of whitespace - message.append(" of type ").append(currentPduTypeNamePadded); // package.class name - message.append(" (protocolFamily ").append(currentProtocolFamilyID); - // message.append(" ").append(currentPduFamilyName); // class name is also available +// String currentPduTypeNamePadded = String.format("%-49s", currentPduTypeName); // - indicates right padding of whitespace +// message.append(" of type ").append(currentPduTypeNamePadded); // package.class name + message.append(" (").append(currentProtocolFamilyID); +// message.append(" ").append(currentPduFamilyName); // class name is also available message.append(")"); System.out.println(message.toString()); @@ -72,11 +72,14 @@ public class AllPduReceiver case COMMENT: CommentPdu commentPdu = (CommentPdu)pdu; // cast to precise type ArrayList<VariableDatum> payloadList = (ArrayList)commentPdu.getVariableDatums(); + if (!payloadList.isEmpty()) + System.out.print (" messages: "); for (VariableDatum variableDatum : payloadList) { String nextComment = new String(variableDatum.getVariableDatumValue()); // convert byte[] to String - System.out.println("\"" + nextComment + "\""); + System.out.print (" \"" + nextComment + "\""); } + System.out.println(); } } else @@ -84,11 +87,11 @@ public class AllPduReceiver } } catch (IOException e) { - System.out.println("Problem with DisExamplesOpenDis7.AllPduReceiver, see exception trace:"); + System.out.println("Problem with OpenDis7Examples.AllPduReceiver, see exception trace:"); System.out.println(e); } finally { - System.out.println("DisExamplesOpenDis7.AllPduReceiver complete."); + System.out.println("OpenDis7Examples.AllPduReceiver complete."); } } } diff --git a/examples/src/OpenDis7Examples/AllPduSender.java b/examples/src/OpenDis7Examples/AllPduSender.java index 1d01685d32e62a81beee06b2ed21538ee265caa0..5bd043d2272534d3963858604167bf136fff4d13 100755 --- a/examples/src/OpenDis7Examples/AllPduSender.java +++ b/examples/src/OpenDis7Examples/AllPduSender.java @@ -4,11 +4,11 @@ import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.*; /** - * This is an example that sends many/most types of PDUs. Useful for testing standards + * This is an application example that sends all 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 * @@ -18,450 +18,477 @@ import edu.nps.moves.dis7.enumerations.*; public class AllPduSender { /** Default multicast group address we send on. */ - public static final String DEFAULT_MULTICAST_ADDRESS = "239.1.2.3"; + public static final String DEFAULT_MULTICAST_ADDRESS = "239.1.2.3"; // PduRecorder "225.4.5.6"; // /** Default multicast port used, matches Wireshark DIS capture default */ public static final int DEFAULT_MULTICAST_PORT = 3000; - private int port; - InetAddress multicastAddress; - - public AllPduSender(int port, String multicast) { + /** Duration in milliseconds, set to 0 to avoid pausing between PDU sends */ + private long THREAD_SLEEP_INTERVAL = 0; + + /** Number of complete loops to perform */ + private int SEND_LOOPS_TO_PERFORM = 1; + + private static InetAddress multicastAddress; + private static int port; + + public AllPduSender(String newMulticastAddress, int newMulticastPort) { + this.port = DEFAULT_MULTICAST_PORT; try { - this.port = port; - multicastAddress = InetAddress.getByName(multicast); + multicastAddress = InetAddress.getByName(newMulticastAddress); if (!multicastAddress.isMulticastAddress()) { - System.out.println("Not a multicast address: " + multicast); + System.out.println("Not a multicast address: " + newMulticastAddress); } + this.port = newMulticastPort; } catch (UnknownHostException e) { System.out.println("Unable to open socket: " + e); } } + @SuppressWarnings("SleepWhileInLoop") public int run() { - System.out.println("DisExamplesOpenDis7.AllPduSender started..."); - try + System.out.println("OpenDis7Examples.AllPduSender started..."); + if (SEND_LOOPS_TO_PERFORM != 1) { - System.out.println("Generate PDUs and note issues, if any..."); - List<Pdu> generatedPdusList = new ArrayList<>(); + float waitIntervalSeconds = ((float)THREAD_SLEEP_INTERVAL / 1000); + float loopIntervalSeconds = ((float)THREAD_SLEEP_INTERVAL / 1000) * 72; // 72 PDUs + float totalDurationSeconds = loopIntervalSeconds * SEND_LOOPS_TO_PERFORM ; + System.out.println("... THREAD_SLEEP_INTERVAL = " + THREAD_SLEEP_INTERVAL + " milliseconds = " + waitIntervalSeconds + " seconds"); + System.out.print ("... running for "); + if (SEND_LOOPS_TO_PERFORM > 1) + System.out.print (SEND_LOOPS_TO_PERFORM + " loops, "); + if (THREAD_SLEEP_INTERVAL > 0) + System.out.println("expected loop interval = " + loopIntervalSeconds + " seconds, total duration = " + + totalDurationSeconds + " seconds = " + (totalDurationSeconds/60.0) + " minutes"); + } + + System.out.println("Generate list of all PDU types and note issues, if any..."); + List<Pdu> generatedPdusList = new ArrayList<>(); + + for (int i = 0; i < SEND_LOOPS_TO_PERFORM; i++) { + + try { + + // Loop through all the enumerated PDU types, create a PDU for each type, + // add that PDU to generatedPdusList, then send each one + for (DISPDUType pdu : DISPDUType.values()) + { + // System.out.println("PDU " + pdu.getValue() + " " + pdu.name() + " " + pdu.getDescription()); // diagnostic + + Pdu aPdu = null; // edu.​nps.​moves7.​dis.PDU superclass for all PDUs, in preparation for custom assignment + + try { + switch (pdu) // using enumeration values from edu.​nps.​moves.​dis7.​enumerations.​DISPDUType + { + // each case value is DISPDUType + case OTHER: // 0 + System.out.println ("*** Note: DISPDUType." + pdu.name() + "=" + pdu.getValue() + " not supported"); // TODO why was this received? + break; // nothing to send + + case ENTITY_STATE: // 1 + aPdu = new EntityStatePdu(); + + EntityStatePdu espdu = (EntityStatePdu) aPdu; + EntityMarking entityMarking = new EntityMarking (); + entityMarking.setCharacters("AllPduSender".getBytes()); //entityMarking.setCharacters(Byte.valueOf("0")); // 11 characters max? + + espdu.setMarking(entityMarking); + Vector3Double espduLocation = new Vector3Double(); + espduLocation.setX(1.0); + espduLocation.setY(2.0); + espduLocation.setZ(3.0); + espdu.setEntityLocation(espduLocation); + // it is important to identify questions as you think of them + // TODO how to set azimuth, i.e. course direction over ground? + break; + + case FIRE: // 2 + aPdu = new FirePdu(); + break; + + case DETONATION: // 3 + aPdu = new DetonationPdu(); + break; + + case COLLISION: // 4 + aPdu = new CollisionPdu(); + break; + + case SERVICE_REQUEST: // 5 + aPdu = new ServiceRequestPdu(); + break; + + case RESUPPLY_OFFER: // 6 + aPdu = new ResupplyOfferPdu(); + break; + + case RESUPPLY_RECEIVED: // 7 + aPdu = new ResupplyReceivedPdu(); + break; + + case RESUPPLY_CANCEL: //8 + aPdu = new ResupplyCancelPdu(); + break; + + case REPAIR_COMPLETE: // 9 + aPdu = new RepairCompletePdu(); + break; + + case REPAIR_RESPONSE: // 10 + aPdu = new RepairResponsePdu(); + break; + + case CREATE_ENTITY: // 11 + aPdu = new CreateEntityPdu(); + break; + + case REMOVE_ENTITY: // 12 + aPdu = new RemoveEntityPdu(); + break; + + case START_RESUME: // 13 + aPdu = new StartResumePdu(); + break; + + case STOP_FREEZE: // 14 + aPdu = new StopFreezePdu(); + break; + + case ACKNOWLEDGE: // 15 + aPdu = new AcknowledgePdu(); + break; + + case ACTION_REQUEST: // 16 + aPdu = new ActionRequestPdu(); + break; + + case ACTION_RESPONSE: // 17 + aPdu = new ActionResponsePdu(); + break; + + case DATA_QUERY: // 18 + aPdu = new DataQueryPdu(); + break; + + case SET_DATA: // 19 + aPdu = new SetDataPdu(); + break; + + case DATA: // 20 + aPdu = new DataPdu(); + break; + + case EVENT_REPORT: // 21 + aPdu = new EventReportPdu(); + break; + + case ELECTROMAGNETIC_EMISSION: // 23 + aPdu = new ElectromagneticEmissionPdu(); + break; + + case DESIGNATOR: // 24 + aPdu = new DesignatorPdu(); + break; + + case TRANSMITTER: // 25 + aPdu = new TransmitterPdu(); + break; + + case SIGNAL: // 26 + aPdu = new SignalPdu(); + break; - // Loop through all the enumerated PDU types, create a PDU for each type, - // add that PDU to generatedPdusList, and send each one - for (DISPDUType pdu : DISPDUType.values()) - { -// System.out.println("PDU " + pdu.getValue() + " " + pdu.name() + " " + pdu.getDescription()); // diagnostic + case RECEIVER: // 27 + aPdu = new ReceiverPdu(); + break; - Pdu aPdu = null; // edu.​nps.​moves7.​dis.PDU superclass for all PDUs, in preparation for custom assignment - - try { - switch (pdu) // using enumeration values from edu.​nps.​moves.​dis7.​enumerations.​DISPDUType - { - // each case value is DISPDUType - case OTHER: // 0 - System.out.println ("*** Note: DISPDUType." + pdu.name() + "=" + pdu.getValue() + " not supported"); // TODO why was this received? - break; // nothing to send - - case ENTITY_STATE: // 1 - aPdu = new EntityStatePdu(); - - EntityStatePdu espdu = (EntityStatePdu) aPdu; - EntityMarking entityMarking = new EntityMarking (); - entityMarking.setCharacters("AllPduSender".getBytes()); //entityMarking.setCharacters(Byte.valueOf("0")); // 11 characters max? - - espdu.setMarking(entityMarking); - Vector3Double espduLocation = new Vector3Double(); - espduLocation.setX(1.0); - espduLocation.setY(2.0); - espduLocation.setZ(3.0); - espdu.setEntityLocation(espduLocation); - // it is important to identify questions as you think of them - // TODO how to set azimuth, i.e. course direction over ground? - break; - - case FIRE: // 2 - aPdu = new FirePdu(); - break; - - case DETONATION: // 3 - aPdu = new DetonationPdu(); - break; - - case COLLISION: // 4 - aPdu = new CollisionPdu(); - break; - - case SERVICE_REQUEST: // 5 - aPdu = new ServiceRequestPdu(); - break; - - case RESUPPLY_OFFER: // 6 - aPdu = new ResupplyOfferPdu(); - break; - - case RESUPPLY_RECEIVED: // 7 - aPdu = new ResupplyReceivedPdu(); - break; - - case RESUPPLY_CANCEL: //8 - aPdu = new ResupplyCancelPdu(); - break; - - case REPAIR_COMPLETE: // 9 - aPdu = new RepairCompletePdu(); - break; - - case REPAIR_RESPONSE: // 10 - aPdu = new RepairResponsePdu(); - break; - - case CREATE_ENTITY: // 11 - aPdu = new CreateEntityPdu(); - break; - - case REMOVE_ENTITY: // 12 - aPdu = new RemoveEntityPdu(); - break; - - case START_RESUME: // 13 - aPdu = new StartResumePdu(); - break; - - case STOP_FREEZE: // 14 - aPdu = new StopFreezePdu(); - break; - - case ACKNOWLEDGE: // 15 - aPdu = new AcknowledgePdu(); - break; - - case ACTION_REQUEST: // 16 - aPdu = new ActionRequestPdu(); - break; - - case ACTION_RESPONSE: // 17 - aPdu = new ActionResponsePdu(); - break; - - case DATA_QUERY: // 18 - aPdu = new DataQueryPdu(); - break; - - case SET_DATA: // 19 - aPdu = new SetDataPdu(); - break; - - case DATA: // 20 - aPdu = new DataPdu(); - break; - - case EVENT_REPORT: // 21 - aPdu = new EventReportPdu(); - break; - - case ELECTROMAGNETIC_EMISSION: // 23 - aPdu = new ElectromagneticEmissionPdu(); - break; - - case DESIGNATOR: // 24 - aPdu = new DesignatorPdu(); - break; - - case TRANSMITTER: // 25 - aPdu = new TransmitterPdu(); - break; - - case SIGNAL: // 26 - aPdu = new SignalPdu(); - break; + case IDENTIFICATION_FRIEND_OR_FOE: // 28 + aPdu = new IdentificationFriendOrFoePdu(); + break; + + case UNDERWATER_ACOUSTIC: // 29 + aPdu = new UnderwaterAcousticPdu(); + break; - case RECEIVER: // 27 - aPdu = new ReceiverPdu(); - break; + case SUPPLEMENTAL_EMISSION_ENTITY_STATE: // 30 + aPdu = new SupplementalEmissionEntityStatePdu(); + break; - case IDENTIFICATION_FRIEND_OR_FOE: // 28 - aPdu = new IdentificationFriendOrFoePdu(); - break; + case INTERCOM_SIGNAL: // 31 + aPdu = new IntercomSignalPdu(); + break; - case UNDERWATER_ACOUSTIC: // 29 - aPdu = new UnderwaterAcousticPdu(); - break; + case INTERCOM_CONTROL: // 32 + aPdu = new IntercomControlPdu(); + break; - case SUPPLEMENTAL_EMISSION_ENTITY_STATE: // 30 - aPdu = new SupplementalEmissionEntityStatePdu(); - break; + case AGGREGATE_STATE: // 33 + aPdu = new AggregateStatePdu(); + break; - case INTERCOM_SIGNAL: // 31 - aPdu = new IntercomSignalPdu(); - break; + case ISGROUPOF: // 34 + aPdu = new IsGroupOfPdu(); + break; - case INTERCOM_CONTROL: // 32 - aPdu = new IntercomControlPdu(); - break; + case TRANSFER_OWNERSHIP: // 35 + aPdu = new TransferOwnershipPdu(); + break; - case AGGREGATE_STATE: // 33 - aPdu = new AggregateStatePdu(); - break; + case ISPARTOF: // 36 + aPdu = new IsPartOfPdu(); + break; - case ISGROUPOF: // 34 - aPdu = new IsGroupOfPdu(); - break; + case MINEFIELD_STATE: // 37 + aPdu = new MinefieldStatePdu(); + break; - case TRANSFER_OWNERSHIP: // 35 - aPdu = new TransferOwnershipPdu(); - break; + case MINEFIELD_QUERY: // 38 + aPdu = new MinefieldQueryPdu(); + break; - case ISPARTOF: // 36 - aPdu = new IsPartOfPdu(); - break; + case MINEFIELD_DATA: // 39 + aPdu = new MinefieldDataPdu(); + break; - case MINEFIELD_STATE: // 37 - aPdu = new MinefieldStatePdu(); - break; + case MINEFIELD_RESPONSE_NACK: // 40 + aPdu = new MinefieldResponseNACKPdu(); + break; - case MINEFIELD_QUERY: // 38 - aPdu = new MinefieldQueryPdu(); - break; + case ENVIRONMENTAL_PROCESS: // 41 + aPdu = new EnvironmentalProcessPdu(); + break; - case MINEFIELD_DATA: // 39 - aPdu = new MinefieldDataPdu(); - break; + case GRIDDED_DATA: // 42 + aPdu = new GriddedDataPdu(); + break; - case MINEFIELD_RESPONSE_NACK: // 40 - aPdu = new MinefieldResponseNACKPdu(); - break; + case POINT_OBJECT_STATE: // 43 + aPdu = new PointObjectStatePdu(); + break; - case ENVIRONMENTAL_PROCESS: // 41 - aPdu = new EnvironmentalProcessPdu(); - break; + case LINEAR_OBJECT_STATE: // 44 + aPdu = new LinearObjectStatePdu(); + break; - case GRIDDED_DATA: // 42 - aPdu = new GriddedDataPdu(); - break; + case AREAL_OBJECT_STATE: // 45 + aPdu = new ArealObjectStatePdu(); + break; - case POINT_OBJECT_STATE: // 43 - aPdu = new PointObjectStatePdu(); - break; + case TIME_SPACE_POSITION_INFORMATION: // 46 + aPdu = new TimeSpacePositionInformationPdu(); + break; - case LINEAR_OBJECT_STATE: // 44 - aPdu = new LinearObjectStatePdu(); - break; + case APPEARANCE: // 47 + aPdu = new AppearancePdu(); + break; - case AREAL_OBJECT_STATE: // 45 - aPdu = new ArealObjectStatePdu(); - break; + case ARTICULATED_PARTS: // 48 + aPdu = new ArticulatedPartsPdu(); + break; - case TIME_SPACE_POSITION_INFORMATION: // 46 - aPdu = new TimeSpacePositionInformationPdu(); - break; + case LIVE_ENTITY_FIRE: // 49 + aPdu = new LiveEntityFirePdu(); + break; - case APPEARANCE: // 47 - aPdu = new AppearancePdu(); - break; + case LIVE_ENTITY_DETONATION: // 50 + aPdu = new LiveEntityDetonationPdu(); + break; - case ARTICULATED_PARTS: // 48 - aPdu = new ArticulatedPartsPdu(); - break; + case CREATE_ENTITY_RELIABLE: // 51 + aPdu = new CreateEntityReliablePdu(); + break; - case LIVE_ENTITY_FIRE: // 49 - aPdu = new LiveEntityFirePdu(); - break; - - case LIVE_ENTITY_DETONATION: // 50 - aPdu = new LiveEntityDetonationPdu(); - break; - - case CREATE_ENTITY_RELIABLE: // 51 - aPdu = new CreateEntityReliablePdu(); - break; - - case REMOVE_ENTITY_RELIABLE: // 52 - aPdu = new RemoveEntityReliablePdu(); - break; - - case START_RESUME_RELIABLE: // 53 - aPdu = new StartResumeReliablePdu(); - break; - - case STOP_FREEZE_RELIABLE: // 54 - aPdu = new StopFreezeReliablePdu(); - break; - - case ACKNOWLEDGE_RELIABLE: // 55 - aPdu = new AcknowledgeReliablePdu(); - break; - - case ACTION_REQUEST_RELIABLE: // 56 - aPdu = new ActionRequestReliablePdu(); - break; - - case ACTION_RESPONSE_RELIABLE: // 57 - aPdu = new ActionResponseReliablePdu(); - break; - - case DATA_QUERY_RELIABLE: // 58 - aPdu = new DataQueryReliablePdu(); - break; - - case SET_DATA_RELIABLE: // 59 - aPdu = new SetDataReliablePdu(); - break; - - case DATA_RELIABLE: // 60 - aPdu = new DataReliablePdu(); - break; - - case EVENT_REPORT_RELIABLE: // 61 - aPdu = new EventReportReliablePdu(); - break; - - case COMMENT_RELIABLE: // 62 - aPdu = new CommentReliablePdu(); - break; - - case RECORD_RELIABLE: // 63 - aPdu = new RecordReliablePdu(); - break; - - case SET_RECORD_RELIABLE: // 64 - aPdu = new SetRecordReliablePdu(); - break; - - case RECORD_QUERY_RELIABLE: // 65 - aPdu = new RecordQueryReliablePdu(); - break; - - case COLLISION_ELASTIC: // 66 - aPdu = new CollisionElasticPdu(); - break; - - case ENTITY_STATE_UPDATE: // 67 - aPdu = new EntityStateUpdatePdu(); - break; - - case DIRECTED_ENERGY_FIRE: // 68 - aPdu = new DirectedEnergyFirePdu(); - break; - - case ENTITY_DAMAGE_STATUS: // 69 - aPdu = new EntityDamageStatusPdu(); - break; - - case INFORMATION_OPERATIONS_ACTION: // 70 - aPdu = new InformationOperationsActionPdu(); - break; - - case INFORMATION_OPERATIONS_REPORT: // 71 - aPdu = new InformationOperationsReportPdu(); - break; - - case ATTRIBUTE: // 72 - aPdu = new AttributePdu(); - break; - - case COMMENT: - // aPdu = new CommentPdu(); // default for this switch logic - - // see Garrett Loffelman and Pete Severson's code for OpenDis version 4 example - // https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/tree/master/assignments/src/MV3500Cohort2018JulySeptember/projects/LoeffelmanSeverson - - CommentPdu newCommentPdu = new CommentPdu(); - ArrayList<VariableDatum> payloadList = new ArrayList<>(); - - ArrayList<String> commentsList = new ArrayList<>(); - commentsList.add("Hello CommentPDU"); - commentsList.add("Here is a second line of text in this comment."); - - if (!commentsList.isEmpty()) - System.out.println("Preparing CommentPDU:"); - - for (String comment : commentsList) - { - VariableDatum newVariableDatum = new VariableDatum(); - newVariableDatum.setVariableDatumValue (comment.getBytes()); // conversion - newVariableDatum.setVariableDatumLengthInBytes(comment.getBytes().length); // also available in bits, see spec and javadoc - // alternatively, you do not need to set this and the marshaller will figure it out from the byte array - // (see javadoc for VariableDatum.setVariableDatumLength()) - payloadList.add(newVariableDatum); - System.out.println(" \"" + comment + "\""); - } - newCommentPdu.setVariableDatums(payloadList); - - aPdu = newCommentPdu; // hand off for sending - break; - - default: - System.out.println("*** Warning: PDU " + pdu.getValue() + " " + pdu + " not supported, created or sent "); - - // code generation block for this class follows: -// System.out.println(" case " + pdu + ": // " + pdu.getValue()); -// System.out.println(" aPdu = new " + pdu.getDescription().replace(" ","").replace("-","").replace("/","") + -// "Pdu();"); -// System.out.println(" break;"); -// System.out.println(); + case REMOVE_ENTITY_RELIABLE: // 52 + aPdu = new RemoveEntityReliablePdu(); + break; + + case START_RESUME_RELIABLE: // 53 + aPdu = new StartResumeReliablePdu(); + break; + + case STOP_FREEZE_RELIABLE: // 54 + aPdu = new StopFreezeReliablePdu(); + break; + + case ACKNOWLEDGE_RELIABLE: // 55 + aPdu = new AcknowledgeReliablePdu(); + break; + + case ACTION_REQUEST_RELIABLE: // 56 + aPdu = new ActionRequestReliablePdu(); + break; + + case ACTION_RESPONSE_RELIABLE: // 57 + aPdu = new ActionResponseReliablePdu(); + break; + + case DATA_QUERY_RELIABLE: // 58 + aPdu = new DataQueryReliablePdu(); + break; + + case SET_DATA_RELIABLE: // 59 + aPdu = new SetDataReliablePdu(); + break; + + case DATA_RELIABLE: // 60 + aPdu = new DataReliablePdu(); + break; + + case EVENT_REPORT_RELIABLE: // 61 + aPdu = new EventReportReliablePdu(); + break; + + case COMMENT_RELIABLE: // 62 + aPdu = new CommentReliablePdu(); + break; + + case RECORD_RELIABLE: // 63 + aPdu = new RecordReliablePdu(); + break; + + case SET_RECORD_RELIABLE: // 64 + aPdu = new SetRecordReliablePdu(); + break; + + case RECORD_QUERY_RELIABLE: // 65 + aPdu = new RecordQueryReliablePdu(); + break; + + case COLLISION_ELASTIC: // 66 + aPdu = new CollisionElasticPdu(); + break; + + case ENTITY_STATE_UPDATE: // 67 + aPdu = new EntityStateUpdatePdu(); + break; + + case DIRECTED_ENERGY_FIRE: // 68 + aPdu = new DirectedEnergyFirePdu(); + break; + + case ENTITY_DAMAGE_STATUS: // 69 + aPdu = new EntityDamageStatusPdu(); + break; + + case INFORMATION_OPERATIONS_ACTION: // 70 + aPdu = new InformationOperationsActionPdu(); + break; + + case INFORMATION_OPERATIONS_REPORT: // 71 + aPdu = new InformationOperationsReportPdu(); + break; + + case ATTRIBUTE: // 72 + aPdu = new AttributePdu(); + break; + + case COMMENT: + // aPdu = new CommentPdu(); // default for this switch logic + + // see Garrett Loffelman and Pete Severson's code for OpenDis version 4 example + // https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/tree/master/assignments/src/MV3500Cohort2018JulySeptember/projects/LoeffelmanSeverson + + CommentPdu newCommentPdu = new CommentPdu(); + ArrayList<VariableDatum> payloadList = new ArrayList<>(); + ArrayList<String> commentsList = new ArrayList<>(); + commentsList.add("Hello CommentPDU"); + commentsList.add("Here is a second line of text in this comment."); + if (!commentsList.isEmpty()) + System.out.println("Preparing CommentPDU:"); + + for (String comment : commentsList) + { + VariableDatum newVariableDatum = new VariableDatum(); + newVariableDatum.setVariableDatumValue (comment.getBytes()); // conversion + newVariableDatum.setVariableDatumLengthInBytes(comment.getBytes().length); // also available in bits, see spec and javadoc + // alternatively, you do not need to set this and the marshaller will figure it out from the byte array + // (see javadoc for VariableDatum.setVariableDatumLength()) + payloadList.add(newVariableDatum); + System.out.println(" \"" + comment + "\""); + } + newCommentPdu.setVariableDatums(payloadList); + + aPdu = newCommentPdu; // hand off for sending + break; + + default: + System.out.println("*** Warning: PDU " + pdu.getValue() + " " + pdu + " not supported, created or sent "); + + // code generation block for this class follows: + // System.out.println(" case " + pdu + ": // " + pdu.getValue()); + // System.out.println(" aPdu = new " + pdu.getDescription().replace(" ","").replace("-","").replace("/","") + + // "Pdu();"); + // System.out.println(" break;"); + // System.out.println(); + } + if (aPdu != null) + { + generatedPdusList.add(aPdu); + } } - if (aPdu != null) + catch (Exception e) { - generatedPdusList.add(aPdu); - } - } - catch (Exception e) - { - System.out.print("Exception thrown for PDU " + pdu.getValue() + " " + pdu); - System.out.print(Arrays.toString(e.getStackTrace())); - // continue looping + System.out.print("Exception thrown for PDU " + pdu.getValue() + " " + pdu); + System.out.print(Arrays.toString(e.getStackTrace())); + // continue looping + } } - } - if (generatedPdusList.size() != 72) // TODO create an enumeration DISType.TOTAL_PDU_TYPES - 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..."); + if (generatedPdusList.size() != 72) // TODO create an enumeration DISType.TOTAL_PDU_TYPES + System.out.println("Error: " + generatedPdusList.size() + " PDUs generated but 72 PDUs expected."); - InetAddress localMulticastAddress = InetAddress.getByName(DEFAULT_MULTICAST_ADDRESS); - MulticastSocket multicastSocket = new MulticastSocket(DEFAULT_MULTICAST_PORT); - 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++) - { - aPdu = generatedPdusList.get(idx); - try + // Send the PDUs we created + System.out.println("Send the " + generatedPdusList.size() + " PDUs we created..."); + + InetAddress localMulticastAddress = InetAddress.getByName(DEFAULT_MULTICAST_ADDRESS); + MulticastSocket multicastSocket = new MulticastSocket(DEFAULT_MULTICAST_PORT); + 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++) { - aPdu.marshal(dos); - - buffer = baos.toByteArray(); - packet = new DatagramPacket(buffer, buffer.length, localMulticastAddress, DEFAULT_MULTICAST_PORT); - multicastSocket.send(packet); - String currentPduTypeValuePadded = String.format("%2s", aPdu.getPduType().getValue()); - String currentPduTypePadded = String.format("%-50s", aPdu.getPduType().toString()); // - indicates right padding of whitespace - System.out.print ("Sent DIS PDU " + currentPduTypeValuePadded + " " + currentPduTypePadded ); - System.out.println(" of type " + aPdu.getClass().getName()); - } - catch (Exception ex) { - System.out.println("Marshaling error" + ex); + aPdu = generatedPdusList.get(idx); + try + { + aPdu.marshal(dos); + + buffer = baos.toByteArray(); + packet = new DatagramPacket(buffer, buffer.length, localMulticastAddress, DEFAULT_MULTICAST_PORT); + multicastSocket.send(packet); + String currentPduTypeValuePadded = String.format("%2s", aPdu.getPduType().getValue()); + String currentPduTypePadded = String.format("%-50s", aPdu.getPduType().toString()); // - indicates right padding of whitespace + System.out.print ("Sent DIS PDU " + currentPduTypeValuePadded + " " + currentPduTypePadded ); + System.out.println(" of type " + aPdu.getClass().getName()); + + if (THREAD_SLEEP_INTERVAL > 0) + Thread.sleep(THREAD_SLEEP_INTERVAL); // pause for debugging + } + catch (Exception ex) { + System.out.println("Marshaling error" + ex); + } } } - // write the PDUs out to an XML file. - //PduContainer container = new PduContainer(); - //container.setPdus(generatedPdus); - //container.marshallToXml("examplePdus.xml"); - return generatedPdusList.size(); - } - catch (IOException e) - { - System.out.println(e); - return -1; - } + catch (IOException e) + { + System.out.println(e); + return -1; + } + } // end repetion loop + + // write the PDUs out to an XML file. + //PduContainer container = new PduContainer(); + //container.setPdus(generatedPdus); + //container.marshallToXml("examplePdus.xml"); + return generatedPdusList.size(); } public static void main(String args[]) @@ -471,16 +498,18 @@ public class AllPduSender if (args.length == 2) { - allPduSender = new AllPduSender(Integer.parseInt(args[0]), args[1]); + allPduSender = new AllPduSender(args[0], Integer.parseInt(args[1])); + System.out.println("Usage: AllPduSender <multicast group> <port>"); + System.out.println("Actual: AllPduSender " + multicastAddress.getHostAddress() + " " + port); totalSentPdus = allPduSender.run(); } else { - System.out.println("Usage: AllPduSender <port> <multicast group>"); - System.out.println("Default: AllPduSender " + DEFAULT_MULTICAST_PORT + " " + DEFAULT_MULTICAST_ADDRESS); - allPduSender = new AllPduSender(DEFAULT_MULTICAST_PORT, DEFAULT_MULTICAST_ADDRESS); + 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(); } - System.out.println("DisExamplesOpenDis7.AllPduSender complete, sent " + totalSentPdus + " PDUs total."); + 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 6ebd47195d57181a4a0778d898693c850745daf8..0fb9babe68333bcaf60edef633bf78d6fdccdc20 100644 --- a/examples/src/OpenDis7Examples/AllPduSenderLog.txt +++ b/examples/src/OpenDis7Examples/AllPduSenderLog.txt @@ -1,90 +1,93 @@ -Invocation instructions: -1. run or debug AllPduSender.java - -Program response: - -=================================================== - +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 239.1.2.3 -DisExamplesOpenDis7.AllPduSender started... -Generate PDUs and note issues, if any... +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: ENTITY_STATE: 1 of type edu.nps.moves.dis7.EntityStatePdu -Sent DIS PDU 2 DISPDUType: FIRE: 2 of type edu.nps.moves.dis7.FirePdu -Sent DIS PDU 3 DISPDUType: DETONATION: 3 of type edu.nps.moves.dis7.DetonationPdu -Sent DIS PDU 4 DISPDUType: COLLISION: 4 of type edu.nps.moves.dis7.CollisionPdu -Sent DIS PDU 5 DISPDUType: SERVICE_REQUEST: 5 of type edu.nps.moves.dis7.ServiceRequestPdu -Sent DIS PDU 6 DISPDUType: RESUPPLY_OFFER: 6 of type edu.nps.moves.dis7.ResupplyOfferPdu -Sent DIS PDU 7 DISPDUType: RESUPPLY_RECEIVED: 7 of type edu.nps.moves.dis7.ResupplyReceivedPdu -Sent DIS PDU 8 DISPDUType: RESUPPLY_CANCEL: 8 of type edu.nps.moves.dis7.ResupplyCancelPdu -Sent DIS PDU 9 DISPDUType: REPAIR_COMPLETE: 9 of type edu.nps.moves.dis7.RepairCompletePdu -Sent DIS PDU 10 DISPDUType: REPAIR_RESPONSE: 10 of type edu.nps.moves.dis7.RepairResponsePdu -Sent DIS PDU 11 DISPDUType: CREATE_ENTITY: 11 of type edu.nps.moves.dis7.CreateEntityPdu -Sent DIS PDU 12 DISPDUType: REMOVE_ENTITY: 12 of type edu.nps.moves.dis7.RemoveEntityPdu -Sent DIS PDU 13 DISPDUType: START_RESUME: 13 of type edu.nps.moves.dis7.StartResumePdu -Sent DIS PDU 14 DISPDUType: STOP_FREEZE: 14 of type edu.nps.moves.dis7.StopFreezePdu -Sent DIS PDU 15 DISPDUType: ACKNOWLEDGE: 15 of type edu.nps.moves.dis7.AcknowledgePdu -Sent DIS PDU 16 DISPDUType: ACTION_REQUEST: 16 of type edu.nps.moves.dis7.ActionRequestPdu -Sent DIS PDU 17 DISPDUType: ACTION_RESPONSE: 17 of type edu.nps.moves.dis7.ActionResponsePdu -Sent DIS PDU 18 DISPDUType: DATA_QUERY: 18 of type edu.nps.moves.dis7.DataQueryPdu -Sent DIS PDU 19 DISPDUType: SET_DATA: 19 of type edu.nps.moves.dis7.SetDataPdu -Sent DIS PDU 20 DISPDUType: DATA: 20 of type edu.nps.moves.dis7.DataPdu -Sent DIS PDU 21 DISPDUType: EVENT_REPORT: 21 of type edu.nps.moves.dis7.EventReportPdu -Sent DIS PDU 22 DISPDUType: COMMENT: 22 of type edu.nps.moves.dis7.CommentPdu -Sent DIS PDU 23 DISPDUType: ELECTROMAGNETIC_EMISSION: 23 of type edu.nps.moves.dis7.ElectromagneticEmissionPdu -Sent DIS PDU 24 DISPDUType: DESIGNATOR: 24 of type edu.nps.moves.dis7.DesignatorPdu -Sent DIS PDU 25 DISPDUType: TRANSMITTER: 25 of type edu.nps.moves.dis7.TransmitterPdu -Sent DIS PDU 26 DISPDUType: SIGNAL: 26 of type edu.nps.moves.dis7.SignalPdu -Sent DIS PDU 27 DISPDUType: RECEIVER: 27 of type edu.nps.moves.dis7.ReceiverPdu -Sent DIS PDU 28 DISPDUType: IDENTIFICATION_FRIEND_OR_FOE: 28 of type edu.nps.moves.dis7.IdentificationFriendOrFoePdu -Sent DIS PDU 29 DISPDUType: UNDERWATER_ACOUSTIC: 29 of type edu.nps.moves.dis7.UnderwaterAcousticPdu -Sent DIS PDU 30 DISPDUType: SUPPLEMENTAL_EMISSION_ENTITY_STATE: 30 of type edu.nps.moves.dis7.SupplementalEmissionEntityStatePdu -Sent DIS PDU 31 DISPDUType: INTERCOM_SIGNAL: 31 of type edu.nps.moves.dis7.IntercomSignalPdu -Sent DIS PDU 32 DISPDUType: INTERCOM_CONTROL: 32 of type edu.nps.moves.dis7.IntercomControlPdu -Sent DIS PDU 33 DISPDUType: AGGREGATE_STATE: 33 of type edu.nps.moves.dis7.AggregateStatePdu -Sent DIS PDU 34 DISPDUType: ISGROUPOF: 34 of type edu.nps.moves.dis7.IsGroupOfPdu -Sent DIS PDU 35 DISPDUType: TRANSFER_OWNERSHIP: 35 of type edu.nps.moves.dis7.TransferOwnershipPdu -Sent DIS PDU 36 DISPDUType: ISPARTOF: 36 of type edu.nps.moves.dis7.IsPartOfPdu -Sent DIS PDU 37 DISPDUType: MINEFIELD_STATE: 37 of type edu.nps.moves.dis7.MinefieldStatePdu -Sent DIS PDU 38 DISPDUType: MINEFIELD_QUERY: 38 of type edu.nps.moves.dis7.MinefieldQueryPdu -Sent DIS PDU 39 DISPDUType: MINEFIELD_DATA: 39 of type edu.nps.moves.dis7.MinefieldDataPdu -Sent DIS PDU 40 DISPDUType: MINEFIELD_RESPONSE_NACK: 40 of type edu.nps.moves.dis7.MinefieldResponseNACKPdu -Sent DIS PDU 41 DISPDUType: ENVIRONMENTAL_PROCESS: 41 of type edu.nps.moves.dis7.EnvironmentalProcessPdu -Sent DIS PDU 42 DISPDUType: GRIDDED_DATA: 42 of type edu.nps.moves.dis7.GriddedDataPdu -Sent DIS PDU 43 DISPDUType: POINT_OBJECT_STATE: 43 of type edu.nps.moves.dis7.PointObjectStatePdu -Sent DIS PDU 44 DISPDUType: LINEAR_OBJECT_STATE: 44 of type edu.nps.moves.dis7.LinearObjectStatePdu -Sent DIS PDU 45 DISPDUType: AREAL_OBJECT_STATE: 45 of type edu.nps.moves.dis7.ArealObjectStatePdu -Sent DIS PDU 46 DISPDUType: TIME_SPACE_POSITION_INFORMATION: 46 of type edu.nps.moves.dis7.TimeSpacePositionInformationPdu -Sent DIS PDU 47 DISPDUType: APPEARANCE: 47 of type edu.nps.moves.dis7.AppearancePdu -Sent DIS PDU 48 DISPDUType: ARTICULATED_PARTS: 48 of type edu.nps.moves.dis7.ArticulatedPartsPdu -Sent DIS PDU 49 DISPDUType: LIVE_ENTITY_FIRE: 49 of type edu.nps.moves.dis7.LiveEntityFirePdu -Sent DIS PDU 50 DISPDUType: LIVE_ENTITY_DETONATION: 50 of type edu.nps.moves.dis7.LiveEntityDetonationPdu -Sent DIS PDU 51 DISPDUType: CREATE_ENTITY_RELIABLE: 51 of type edu.nps.moves.dis7.CreateEntityReliablePdu -Sent DIS PDU 52 DISPDUType: REMOVE_ENTITY_RELIABLE: 52 of type edu.nps.moves.dis7.RemoveEntityReliablePdu -Sent DIS PDU 53 DISPDUType: START_RESUME_RELIABLE: 53 of type edu.nps.moves.dis7.StartResumeReliablePdu -Sent DIS PDU 54 DISPDUType: STOP_FREEZE_RELIABLE: 54 of type edu.nps.moves.dis7.StopFreezeReliablePdu -Sent DIS PDU 55 DISPDUType: ACKNOWLEDGE_RELIABLE: 55 of type edu.nps.moves.dis7.AcknowledgeReliablePdu -Sent DIS PDU 56 DISPDUType: ACTION_REQUEST_RELIABLE: 56 of type edu.nps.moves.dis7.ActionRequestReliablePdu -Sent DIS PDU 57 DISPDUType: ACTION_RESPONSE_RELIABLE: 57 of type edu.nps.moves.dis7.ActionResponseReliablePdu -Sent DIS PDU 58 DISPDUType: DATA_QUERY_RELIABLE: 58 of type edu.nps.moves.dis7.DataQueryReliablePdu -Sent DIS PDU 59 DISPDUType: SET_DATA_RELIABLE: 59 of type edu.nps.moves.dis7.SetDataReliablePdu -Sent DIS PDU 60 DISPDUType: DATA_RELIABLE: 60 of type edu.nps.moves.dis7.DataReliablePdu -Sent DIS PDU 61 DISPDUType: EVENT_REPORT_RELIABLE: 61 of type edu.nps.moves.dis7.EventReportReliablePdu -Sent DIS PDU 62 DISPDUType: COMMENT_RELIABLE: 62 of type edu.nps.moves.dis7.CommentReliablePdu -Sent DIS PDU 63 DISPDUType: RECORD_RELIABLE: 63 of type edu.nps.moves.dis7.RecordReliablePdu -Sent DIS PDU 64 DISPDUType: SET_RECORD_RELIABLE: 64 of type edu.nps.moves.dis7.SetRecordReliablePdu -Sent DIS PDU 65 DISPDUType: RECORD_QUERY_RELIABLE: 65 of type edu.nps.moves.dis7.RecordQueryReliablePdu -Sent DIS PDU 66 DISPDUType: COLLISION_ELASTIC: 66 of type edu.nps.moves.dis7.CollisionElasticPdu -Sent DIS PDU 67 DISPDUType: ENTITY_STATE_UPDATE: 67 of type edu.nps.moves.dis7.EntityStateUpdatePdu -Sent DIS PDU 68 DISPDUType: DIRECTED_ENERGY_FIRE: 68 of type edu.nps.moves.dis7.DirectedEnergyFirePdu -Sent DIS PDU 69 DISPDUType: ENTITY_DAMAGE_STATUS: 69 of type edu.nps.moves.dis7.EntityDamageStatusPdu -Sent DIS PDU 70 DISPDUType: INFORMATION_OPERATIONS_ACTION: 70 of type edu.nps.moves.dis7.InformationOperationsActionPdu -Sent DIS PDU 71 DISPDUType: INFORMATION_OPERATIONS_REPORT: 71 of type edu.nps.moves.dis7.InformationOperationsReportPdu -Sent DIS PDU 72 DISPDUType: ATTRIBUTE: 72 of type edu.nps.moves.dis7.AttributePdu -DisExamplesOpenDis7.AllPduSender complete, sent 72 PDUs total. -BUILD SUCCESSFUL (total time: 2 seconds) +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) diff --git a/examples/src/OpenDis7Examples/EspduReceiver.java b/examples/src/OpenDis7Examples/EspduReceiver.java index 81eb4183d1f63d9b5bd8a7c51ed60de94d807e6f..560adf8d65f28a8430f2023201033a6a7415a082 100755 --- a/examples/src/OpenDis7Examples/EspduReceiver.java +++ b/examples/src/OpenDis7Examples/EspduReceiver.java @@ -4,7 +4,7 @@ import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.utilities.*; /** @@ -26,15 +26,21 @@ public class EspduReceiver /** Default multicast port used, matches Wireshark DIS capture default */ public static final int DEFAULT_MULTICAST_PORT = EspduSender.DEFAULT_MULTICAST_PORT; + + /** + * Output prefix to identify this class + */ + private final static String TRACE_PREFIX = "[" + EspduReceiver.class.getName() + "] "; public static void main(String args[]) { - System.out.println("DisExamplesOpenDis7.EspduReceiver started..."); + System.out.println(TRACE_PREFIX + "started..."); MulticastSocket socket; - DatagramPacket packet; - InetAddress address; - PduFactory pduFactory = new PduFactory(); + DatagramPacket packet; + InetAddress address; + PduFactory pduFactory = new PduFactory(); + int pduCount = 0; try { // Specify the socket to receive data @@ -42,8 +48,11 @@ public class EspduReceiver // socket.setBroadcast(true); address = InetAddress.getByName(DEFAULT_MULTICAST_ADDRESS); - socket.joinGroup(address); - +////// socket.joinGroup(address); // TODO not needed! + + System.out.println(TRACE_PREFIX + "listening for PDU packets on " + address.getHostAddress() + " port " + DEFAULT_MULTICAST_PORT); + System.out.println("==============="); + while (true) // Loop infinitely, receiving datagrams { byte buffer[] = new byte[MAX_PDU_SIZE]; @@ -56,36 +65,38 @@ public class EspduReceiver System.out.println("Bundle size is " + pduBundle.size()); // end iterator loop through PDU bundle - for (Pdu aPdu : pduBundle) { - String receiptMessage = "received PDU type " + aPdu.getPduType().getValue() + "=" + aPdu.getPduType().name() + " " + aPdu.getClass().getName(); + for (Pdu aPdu : pduBundle) + { + pduCount++; + String receiptMessage = String.format("%3s", pduCount) // right justify, 3 characters + + ". received PDU type " + aPdu.getPduType().getValue() + "=" + aPdu.getPduType().name() + " " + aPdu.getClass().getName(); if (aPdu instanceof EntityStatePdu) { - System.out.println("==============="); System.out.println(receiptMessage); EntityID entityID = ((EntityStatePdu)aPdu).getEntityID(); Vector3Double position = ((EntityStatePdu)aPdu).getEntityLocation(); - System.out.println(" entityID triplet: [" + entityID.getSiteID()+ ", " + entityID.getApplicationID()+ ", " + entityID.getEntityID()+ "] "); - System.out.println(" Location in DIS coordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]"); + System.out.println(" entityID triplet: [" + entityID.getSiteID()+ ", " + entityID.getApplicationID()+ ", " + entityID.getEntityID()+ "] "); + System.out.println(" Location in DIS coordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]"); } else if (aPdu instanceof FirePdu) { System.out.println(receiptMessage); Vector3Double position = ((FirePdu)aPdu).getLocationInWorldCoordinates(); - System.out.println(" FirePdu locationInWorldCoordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]"); - + System.out.println(" FirePdu locationInWorldCoordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]"); + System.out.println("==============="); } else { System.out.println(receiptMessage); } - } - } // end while + } // end of bundle loop + } // end of while loop } // end try block - catch (IOException e) + catch (IOException ioe) { - System.out.println("Problem with DisExamplesOpenDis7.EspduReceiver, see exception trace:"); - System.out.println(e); + System.out.println(TRACE_PREFIX + "Problem with input/output, see exception trace:"); + System.out.println(ioe); } - System.out.println("DisExamplesOpenDis7.EspduReceiver complete."); + System.out.println(TRACE_PREFIX + "complete."); } // end main } // end class diff --git a/examples/src/OpenDis7Examples/EspduSender.java b/examples/src/OpenDis7Examples/EspduSender.java index 2933e2da02151db7b0064163a00def6b3606eda1..28178a9d36f4bdf962a9da4f0a742cd465fbc635 100644 --- a/examples/src/OpenDis7Examples/EspduSender.java +++ b/examples/src/OpenDis7Examples/EspduSender.java @@ -4,11 +4,12 @@ import java.io.*; import java.net.*; import java.util.*; -import edu.nps.moves.dis7.*; +import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.enumerations.Country; import edu.nps.moves.dis7.enumerations.EntityKind; import edu.nps.moves.dis7.enumerations.PlatformDomain; import edu.nps.moves.dis7.utilities.*; +import edu.nps.moves.dis7.entities.usa.platform.land.M1A2; /** * Creates and sends ESPDUs in IEEE binary format. Adapted from OpenDIS library @@ -22,7 +23,7 @@ public class EspduSender /** * Putting any upper limit on # packets sent avoids possibility of non-terminating infinite loops that continue sending packets. */ - public static final int NUMBER_PDUS_TO_SEND = 5; // 5000 + public static final int NUMBER_OF_LOOPS = 1; // 5 /** * Default multicast group address we send on. @@ -32,11 +33,16 @@ public class EspduSender /** * Default multicast port used, matches Wireshark DIS capture default */ - public static final int DEFAULT_MULTICAST_PORT = 3000; - + public static final int DEFAULT_MULTICAST_PORT = 3000; + public enum NetworkMode { UNICAST, MULTICAST, BROADCAST }; + + /** + * Output prefix to identify this class, helps with logging + */ + private final static String TRACE_PREFIX = "[" + EspduSender.class.getName() + "] "; /** * Possible system properties, passed in via -Dattr=val networkMode: @@ -52,16 +58,16 @@ public class EspduSender @SuppressWarnings("SleepWhileInLoop") // allows Thread.sleep(value) without warning in code public static void main(String args[]) { - System.out.println("DisExamplesOpenDis7.EspduSender started..."); + System.out.println(TRACE_PREFIX + " started..."); - // Default settings. These are used if no system properties are set. - // If system properties are passed in, these are overridden later. - NetworkMode networkMode = NetworkMode.BROADCAST; - InetAddress address = null; // must be initialized, even if null - int port = DEFAULT_MULTICAST_PORT; - MulticastSocket socket = null; // must be initialized to avoid later error, even if null; - EntityStatePdu espdu = new EntityStatePdu(); - DisTime disTime = new DisTime(); + // Default settings. These are used if no system properties are set. + // If system properties are passed in, these are overridden later. + NetworkMode networkMode = NetworkMode.MULTICAST; + InetAddress address = null; // must be initialized, even if null + int port = DEFAULT_MULTICAST_PORT; + MulticastSocket socket = null; // must be initialized to avoid later error, even if null; + EntityStatePdu espdu = new EntityStatePdu(); + DisTime disTime = new DisTime(); // ICBM coordinates for my office double latitude = 36.595517; @@ -72,7 +78,7 @@ public class EspduSender } catch (UnknownHostException e) { - System.out.println(e + " Cannot create multicast address"); + System.out.println(TRACE_PREFIX + e + " Cannot create multicast address"); System.exit(0); } @@ -121,16 +127,30 @@ public class EspduSender { throw new RuntimeException("*** Error: sending to multicast address, but destination address " + address.toString() + "is not multicast"); } - socket.joinGroup(address); + socket.joinGroup(address); // TODO select correct NetworkInterface } } // end networkModeString + else if (networkMode == NetworkMode.MULTICAST) + { + networkModeString = "multicast"; + } + else if (networkMode == NetworkMode.UNICAST) + { + networkModeString = "unicast"; + } + else if (networkMode == NetworkMode.BROADCAST) + { + networkModeString = "broadcast"; + } } catch (IOException | RuntimeException e) { - System.out.println("Unable to initialize network correctly, exiting."); + System.out.println(TRACE_PREFIX + "Unable to initialize network correctly, exiting."); System.out.println(e); System.exit(-1); // outta here } + System.out.println(TRACE_PREFIX + " sending " + networkModeString + " ESPDU packets to " + + address.getHostAddress() + " port " + port); // Initialize values in the Entity State PDU object. The exercise ID is // a way to differentiate between different virtual worlds on one network. @@ -147,7 +167,7 @@ public class EspduSender entityID.setSiteID ((short)1); // TODO utility method to allow int values entityID.setApplicationID((short)2); entityID.setEntityID ((short)3); - espdu.setEntityID(entityID); + espdu.setEntityID(entityID); // TODO utility method to allow setting all three at once // Set the entity type. SISO has a big list of enumerations, so that by // specifying various numbers we can say this is an M1A2 American tank, @@ -156,27 +176,39 @@ public class EspduSender // enumerations in C++ and Java, but to keep things simple we just use // numbers here. + // Manual way to override platform information: + EntityType entityType = espdu.getEntityType() + .setEntityKind (EntityKind.PLATFORM).setEntityKind (EntityKind.PLATFORM) //(short) 1); // Platform (vs lifeform, munition, sensor, etc.); //(short) 1); // Platform (vs lifeform, munition, sensor, etc.) + .setCountry (Country.UNITED_STATES_OF_AMERICA_USA) // 225 USA + .setDomain (Domain.inst(PlatformDomain.LAND)) // Land (vs air, surface, subsurface, space) + .setCategory ((byte) 1) // Tank + .setSubCategory((byte) 1) // M1 Abrams + .setSpecific ((byte) 3); // M1A2 Abrams + // New way using entity jar(s) espdu.setEntityType(new edu.nps.moves.dis7.entities.usa.platform.land.M1A2()); - - // Manual way: - /* - */ - EntityType entityType = espdu.getEntityType(); - entityType.setEntityKind(EntityKind.PLATFORM); //(short) 1); // Platform (vs lifeform, munition, sensor, etc.) - entityType.setCountry(Country.UNITED_STATES_OF_AMERICA_USA); // 225 USA - entityType.setDomain(Domain.inst(PlatformDomain.LAND)); // Land (vs air, surface, subsurface, space) - entityType.setCategory ((byte) 1); // Tank - entityType.setSubCategory((byte) 1); // M1 Abrams - entityType.setSpecific ((byte) 3); // M1A2 Abrams + // or simply use an enumeration by name, with accompanying import statement above + espdu.setEntityType(new M1A2()); - Set<InetAddress> broadcastAddresses; + // Inspecting an enumeration + System.out.println("==============="); + System.out.println("espdu entityType information:"); + System.out.println(" EntityKind =" + espdu.getEntityType().getEntityKind()); + System.out.println(" Country =" + espdu.getEntityType().getCountry()); + System.out.println(" Domain =" + espdu.getEntityType().getDomain()); + System.out.println(" Category =" + espdu.getEntityType().getCategory()); + System.out.println(" SubCategory=" + espdu.getEntityType().getSubCategory()); + System.out.println(" Specific =" + espdu.getEntityType().getCountry()); + // TODO round trip lookup + + Set<InetAddress> localNetworkAddresses; try // Loop through sending N ESPDUs { - System.out.println("Sending " + NUMBER_PDUS_TO_SEND + " sets of packets:"); // + address.toString() + System.out.println(TRACE_PREFIX + "sending " + NUMBER_OF_LOOPS + " sets of packets:"); // + address.toString() - for (int index = 0; index < NUMBER_PDUS_TO_SEND; index++) { + for (int index = 0; index < NUMBER_OF_LOOPS; 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. // This means that if you start sending just before the top of the hour @@ -264,33 +296,64 @@ public class EspduSender firePdu.setLocationInWorldCoordinates(espdu.getEntityLocation()); byte[] fireArray = firePdu.marshal(); - broadcastAddresses = getBroadcastAddresses(); - for (InetAddress broadcast : broadcastAddresses) { - if (espduArray.length > 0) - { - System.out.println("Sending espdu datagram packet to " + broadcast); - packet = new DatagramPacket(espduArray, espduArray.length, broadcast, port); - socket.send(packet); - } - // TODO experiment with these! 8) - if (fireArray.length > 0) - { - System.out.println("Sending fire datagram packet to " + broadcast); - packet = new DatagramPacket(fireArray, fireArray.length, broadcast, port); // alternate - socket.send(packet); - } } - +// CommentPdu newCommentPdu = new CommentPdu(); +// ArrayList<VariableDatum> payloadList = new ArrayList<>(); +// ArrayList<String> commentsList = new ArrayList<>(); +// commentsList.add("Hello CommentPDU"); +// commentsList.add("Here is a second line of text in this comment."); +// if (!commentsList.isEmpty()) +// System.out.println("Preparing CommentPDU:"); +// +// for (String comment : commentsList) +// { +// VariableDatum newVariableDatum = new VariableDatum(); +// newVariableDatum.setVariableDatumValue (comment.getBytes()); // conversion +// newVariableDatum.setVariableDatumLengthInBytes(comment.getBytes().length); // also available in bits, see spec and javadoc +// // alternatively, you do not need to set this and the marshaller will figure it out from the byte array +// // (see javadoc for VariableDatum.setVariableDatumLength()) +// payloadList.add(newVariableDatum); +// System.out.println(" \"" + comment + "\""); +// } +// newCommentPdu.setVariableDatums(payloadList); +// byte[] commentArray = newCommentPdu.marshal(); + + localNetworkAddresses = getBroadcastAddresses(); + 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); + 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 + socket.send(packet); + } +// // TODO experiment with these! 8) +// if (newCommentPdu != null) +// { +// System.out.println(TRACE_PREFIX + "sending datagram packet [" + newCommentPdu.getPduType().toString() + " ] to " + +// String.format("%-15s", networkAddress.getHostAddress()) + " port " + port); +// packet = new DatagramPacket(commentArray, commentArray.length, networkAddress, port); // alternate +// socket.send(packet); +// } + } // Send every 1 second within loop. Otherwise all this will be all over in a fraction of a second. Thread.sleep(1000); // msec } } catch (Exception e) { - System.out.println("Problem with DisExamplesOpenDis7.EspduSender, see exception trace:"); + System.out.println(TRACE_PREFIX + "Problem with " + e + ", see exception trace:"); System.out.println(e); } System.out.println("==============="); - System.out.println("DisExamplesOpenDis7.EspduSender complete."); + System.out.println(TRACE_PREFIX + "complete."); } /** @@ -319,25 +382,25 @@ public class EspduSender if (anInterface.isUp()) { - for (InterfaceAddress anAddress : anInterface.getInterfaceAddresses()) { - if ((anAddress == null || anAddress.getAddress().isLinkLocalAddress())) - { - continue; - } - - //System.out.println("Getting broadcast address for " + anAddress); - InetAddress broadcastAddress = anAddress.getBroadcast(); - if (broadcastAddress != null) - { - broadcastAddresses.add(broadcastAddress); - } - } + for (InterfaceAddress anAddress : anInterface.getInterfaceAddresses()) { + if ((anAddress == null || anAddress.getAddress().isLinkLocalAddress())) + { + continue; + } + + //System.out.println("Getting broadcast address for " + anAddress); + InetAddress broadcastAddress = anAddress.getBroadcast(); + if (broadcastAddress != null) + { + broadcastAddresses.add(broadcastAddress); + } + } } } } catch (SocketException e) { - System.out.println("Problem with DisExamplesOpenDis7.EspduSender.getBroadcastAddresses(), see exception trace:"); + System.out.println(TRACE_PREFIX + "Problem with .getBroadcastAddresses(), see exception trace:" + e); System.out.println(e); } return broadcastAddresses; diff --git a/examples/src/OpenDis7Examples/ExampleSimulationProgram.java b/examples/src/OpenDis7Examples/ExampleSimulationProgram.java index e3bb082c56cd61ddb60dca80a197698962690543..5242ce94c316d1628e76a8530d696d44f217f55d 100644 --- a/examples/src/OpenDis7Examples/ExampleSimulationProgram.java +++ b/examples/src/OpenDis7Examples/ExampleSimulationProgram.java @@ -196,6 +196,8 @@ public class ExampleSimulationProgram /** * User-modifiable method for defining and running a simulation. + * Support include DIS EntityStatePdu, FirePdu and CommentPdu all available for + * modification and sending in a simulation loop. */ public void runSimulation () { @@ -206,7 +208,7 @@ public class ExampleSimulationProgram // model setup EntityID entityID_1 = new EntityID(); - entityID_1.setSiteID(1).setApplicationID(2).setEntityID(3); + entityID_1.setSiteID(1).setApplicationID(2).setEntityID(3); // made-up example ID EntityStatePdu entityStatePdu = pduFactory.makeEntityStatePdu(); entityStatePdu.setEntityID(entityID_1); @@ -222,12 +224,20 @@ public class ExampleSimulationProgram // =============================== // your own simulation code here! + // compute a track, update an ESPDU + + entityStatePdu.getEntityLocation().setX(entityStatePdu.getEntityLocation().getX() + 1.0); + + // decide whether to fire, and then update the firePdu. Hmmm, you might want a target to shoort at! + + // etc. + // your narrative code for CommentPdu here, set all to empty strings to avoid sending - narrativeMessage1 = "MV3500 ExampleSimulation"; - narrativeMessage2 = "runSimulation loop " + loopCount; + narrativeMessage1 = "MV3500 ExampleSimulationProgram"; + narrativeMessage2 = "runSimulation() loop " + loopCount; narrativeMessage3 = ""; // intentionally blank for testing // =============================== diff --git a/examples/src/OpenDis7Examples/PduListenerSaver.java b/examples/src/OpenDis7Examples/PduListenerSaver.java index 3e0f35a7b7c7bcc02d845af76e3608f22d4e7782..769f82e140057da5c3b8d88ece6335a9c973e5eb 100644 --- a/examples/src/OpenDis7Examples/PduListenerSaver.java +++ b/examples/src/OpenDis7Examples/PduListenerSaver.java @@ -36,7 +36,7 @@ public class PduListenerSaver String multicastAddress = DEFAULT_MULTICAST_ADDRESS; int multicastPort = DEFAULT_MULTICAST_PORT; - System.out.println("DisExamplesOpenDis7.PduListenerSaver started..."); + System.out.println("OpenDis7Examples.PduListenerSaver started..."); switch (args.length) { case 0: @@ -67,18 +67,27 @@ public class PduListenerSaver if (line.equalsIgnoreCase("p") && state == mystate.RUNNING) { recorder.stopPause(); state = mystate.PAUSED; + System.out.println("... now PAUSED"); + } + else if (line.equalsIgnoreCase("p")) { + System.out.println("... still PAUSED"); } else if (line.equalsIgnoreCase("r") && state == mystate.PAUSED) { recorder.startResume(); state = mystate.RUNNING; + System.out.println("... now RUNNING"); + } + else if (line.equalsIgnoreCase("r")) { + System.out.println("... still RUNNING"); } else if (line.equalsIgnoreCase("q")) { + System.out.println("... QUIT"); recorder.end(); break; } } System.out.println("Ending PduListenerSaver pdu recording, saved to file:"); - System.out.println(recorder.getLogFile()); + System.out.println(recorder.getLogFilePath()); } catch (IOException ex) { System.err.println("Exception: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage()); diff --git a/examples/src/OpenDis7Examples/PduReaderPlayer.java b/examples/src/OpenDis7Examples/PduReaderPlayer.java index bdfc3c568c576e3bedaf95e4c9736be1044ab482..9564e2fc8918f707eb7e500a559b7a4db02ec473 100644 --- a/examples/src/OpenDis7Examples/PduReaderPlayer.java +++ b/examples/src/OpenDis7Examples/PduReaderPlayer.java @@ -38,7 +38,7 @@ public class PduReaderPlayer int multicastPort = DEFAULT_MULTICAST_PORT; boolean sendToNet = false; - System.out.println("DisExamplesOpenDis7.PduReaderPlayer started..."); + System.out.println("OpenDis7Examples.PduReaderPlayer started..."); switch (args.length) { case 0: @@ -84,7 +84,7 @@ public class PduReaderPlayer } } System.out.println("Ending pdu files playback for directory " + outputDirectory); - System.out.println("DisExamplesOpenDis7.PduReaderPlayer complete."); + System.out.println("OpenDis7Examples.PduReaderPlayer complete."); System.exit(0); // not sure why this is necessary with Netbeans... } catch (IOException ex) { diff --git a/examples/src/TcpExamples/TcpExample3Client.java b/examples/src/TcpExamples/TcpExample3Client.java index a5841c8d2804b061eca53741ddd6943b9b660d74..cb346fa0833a42238dbbf1e723314ebbb7980126 100644 --- a/examples/src/TcpExamples/TcpExample3Client.java +++ b/examples/src/TcpExamples/TcpExample3Client.java @@ -22,7 +22,7 @@ public class TcpExample3Client { public static void main(String[] args) { // Local variables/fields - Socket socket; + Socket socket = null; InputStream is; InputStreamReader isr; BufferedReader br; @@ -72,6 +72,11 @@ public class TcpExample3Client { } finally // occurs after any other activity when shutting down { + try { + if (socket != null) + socket.close(); + } catch (IOException e) {} + // program exit: tell somebody about that happening. Likely cause: server drops connection. System.out.println(); System.out.println("TcpExample3Client exit"); diff --git a/examples/src/TcpExamples/TcpExample4Client.java b/examples/src/TcpExamples/TcpExample4Client.java index 7e404e708c76918a92bed311e4469a1164231138..0171540dd69ac067d9c77ac1095eea60f9d77b02 100644 --- a/examples/src/TcpExamples/TcpExample4Client.java +++ b/examples/src/TcpExamples/TcpExample4Client.java @@ -15,7 +15,8 @@ import java.net.*; */ public class TcpExample4Client { - static int MAX_LOOP_COUNT = 4; + static String DESTINATION_HOST = "localhost"; + static int MAX_LOOP_COUNT = 4; public static void main(String[] args) { @@ -37,7 +38,7 @@ public class TcpExample4Client long startTime = System.currentTimeMillis(); // open a socket for each loop - Socket socket = new Socket("localhost", 2317); + Socket socket = new Socket(DESTINATION_HOST, 2317); // Setup. Read the single line written by the server. // We'd do things a bit differently if many lines to be read diff --git a/examples/src/UdpMulticastExamples/MulticastReceiver.java b/examples/src/UdpMulticastExamples/MulticastReceiver.java index 9a49f52b51e747452296682b20d93378419028ac..9c8716d99de7e3cb373803f502447850a8604cc0 100644 --- a/examples/src/UdpMulticastExamples/MulticastReceiver.java +++ b/examples/src/UdpMulticastExamples/MulticastReceiver.java @@ -1,6 +1,6 @@ package UdpMulticastExamples; -import edu.nps.moves.dis7.utilities.DisThreadedNetIF; +import edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface; import java.io.*; import java.net.*; import java.nio.ByteBuffer; @@ -19,7 +19,7 @@ public class MulticastReceiver { // 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; + public static final int DESTINATION_PORT = 1718; /** * Time to live: how many router-decrement levels can be crossed @@ -53,7 +53,7 @@ public class MulticastReceiver { group = new InetSocketAddress(multicastAddress, DESTINATION_PORT); // Join group useful on receiving side - multicastSocket.joinGroup(group, ni = DisThreadedNetIF.findIpv4Interface()); + multicastSocket.joinGroup(group, ni = DisThreadedNetworkInterface.findIpv4Interface()); // You can join multiple groups here System.out.println("Multicast address/port: " + multicastAddress.getHostAddress() + "/" + DESTINATION_PORT); diff --git a/examples/src/UdpMulticastExamples/MulticastSender.java b/examples/src/UdpMulticastExamples/MulticastSender.java index ef30a4d4f540144eff6b023d8761e143ab8f7be2..b4021f019653f418edf6b2d891d0ed84848f6984 100644 --- a/examples/src/UdpMulticastExamples/MulticastSender.java +++ b/examples/src/UdpMulticastExamples/MulticastSender.java @@ -1,8 +1,10 @@ package UdpMulticastExamples; -import edu.nps.moves.dis7.utilities.DisThreadedNetIF; +import edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface; import java.io.*; import java.net.*; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Looks a lot like UdpSender. Start this after launching MulticastReceiver. @@ -28,11 +30,13 @@ public class MulticastSender { public static final int LOOPSIZE = 20; // 20000 public static final String QUIT_SENTINEL = "QUIT QUIT QUIT!"; + private static NetworkInterface ni; @SuppressWarnings("SleepWhileInLoop") public static void main(String[] args) throws IOException { MulticastSocket multicastSocket = null; + InetSocketAddress group = null; // Put together a message with binary content. "ByteArrayOutputStream" // is a java.io utility that lets us put together an array of binary @@ -51,18 +55,18 @@ public class MulticastSender { System.setProperty("java.net.preferIPv4Stack", "true"); // multicast group we are sending to--not a single host - multicastSocket = new MulticastSocket(DESTINATION_PORT); + multicastSocket = new MulticastSocket(/*DESTINATION_PORT*/); multicastSocket.setTimeToLive(TTL); // time to live reduces scope of transmission InetAddress multicastAddress = InetAddress.getByName(MULTICAST_ADDRESS); System.out.println("Multicast address/port: " + multicastAddress.getHostAddress() + "/" + DESTINATION_PORT); - InetSocketAddress group = new InetSocketAddress(multicastAddress, DESTINATION_PORT); + group = new InetSocketAddress(multicastAddress, DESTINATION_PORT); // Join group useful on receiving side - multicastSocket.joinGroup(group, DisThreadedNetIF.findIpv4Interface()); + multicastSocket.joinGroup(group, ni = DisThreadedNetworkInterface.findIpv4Interface()); // You can join multiple groups here byte[] buffer = baos.toByteArray(); - DatagramPacket packet = new DatagramPacket(buffer, buffer.length, multicastAddress, DESTINATION_PORT); + DatagramPacket packet = new DatagramPacket(buffer, buffer.length, group/*, DESTINATION_PORT*/); for (int index = 0; index < LOOPSIZE; index++) { @@ -99,8 +103,14 @@ public class MulticastSender { System.err.println(e); } finally { - if (multicastSocket != null) + if (multicastSocket != null && !multicastSocket.isClosed()) { + try { + multicastSocket.leaveGroup(group, ni); + } catch (IOException ex) { + Logger.getLogger(MulticastSender.class.getName()).log(Level.SEVERE, null, ex); + } multicastSocket.close(); + } dos.close(); } diff --git a/examples/src/UdpMulticastExamples/UdpSender.java b/examples/src/UdpMulticastExamples/UdpSender.java index 499122c2a805313d605afa44e0ff87ce69ff0629..8a658e878bb7ec212e666fc5ebeeea6b51617312 100644 --- a/examples/src/UdpMulticastExamples/UdpSender.java +++ b/examples/src/UdpMulticastExamples/UdpSender.java @@ -20,10 +20,12 @@ public class UdpSender { // System properties: https://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html public static final String MY_NAME = System.getProperty("user.name"); // guru incantation 8) - public static final int SENDING_PORT = 1414; +// public static final int SENDING_PORT = 1414; // not needed, can let system choose an open local port public static final int RECEIVING_PORT = 1415; public static final int TOTAL_PACKETS_TO_SEND = 100; - public static final String DESTINATION_HOST = "10.1.105.8"; + + // here is what we need for lab comms + public static final String DESTINATION_HOST = "10.1.105.16"; // localhost 127.0.0.1 or argon 10.1.105.1 or 10.1.105.1 or whatever @SuppressWarnings("SleepWhileInLoop") public static void main(String[] args) throws IOException @@ -32,7 +34,7 @@ public class UdpSender DataOutputStream dos = null; int packetID = 0; // counter variable to send in packet float value = -1.0f; // unreachable value is good sentinel to ensure expected changes occur - String message = "We got London on da Track"; // no really + String message = MY_NAME + " says Hello MV3500"; // no really String padding = new String(); try @@ -41,7 +43,7 @@ public class UdpSender System.out.println(UdpSender.class.getName() + " started..."); // Create a UDP socket - udpSocket = new DatagramSocket(SENDING_PORT); + udpSocket = new DatagramSocket(); // let system assign output port, then SENDING_PORT not needed // Put together a message with binary content. "ByteArrayOutputStream" // is a java.io utility that lets us put together an array of binary @@ -68,8 +70,8 @@ public class UdpSender for (int index = 1; index <= TOTAL_PACKETS_TO_SEND; index++) // avoid infinite send loops in code, they can be hard to kill! { - packetID++; // increment counter, prefer using explicit value to index - value = 100 - packetID; // countdown + packetID++; // increment counter, prefer using explicit value to index + value = TOTAL_PACKETS_TO_SEND - packetID; // countdown boolean isPacketIdEvenParity = ((packetID % 2) == 0); // % is modulo operator; result 0 is even parity, 1 is odd parity // values of interest follow. order and types of what was sent must match what you are reading! @@ -82,6 +84,7 @@ public class UdpSender byteArray = baos.toByteArray(); // OK so go get the flushed result... datagramPacket.setData(byteArray); // and put it in the packet... udpSocket.send(datagramPacket); // and send it away. boom gone, nonblocking. +// System.out.println("udpSocket output port=" + udpSocket.getLocalPort()); // diagnostic tells what port was chosen by system if (isPacketIdEvenParity) padding = " "; diff --git a/lib/open-dis7-entities-all.jar b/lib/open-dis7-entities-all.jar deleted file mode 100644 index bf060b7480f219bcd0d821c1a466e257a81bd33e..0000000000000000000000000000000000000000 Binary files a/lib/open-dis7-entities-all.jar and /dev/null differ diff --git a/lib/open-dis7-java.jar b/lib/open-dis7-java.jar deleted file mode 100644 index 638d31ec50395d2c1989181448740e172623e307..0000000000000000000000000000000000000000 Binary files a/lib/open-dis7-java.jar and /dev/null differ diff --git a/lib/open-dis7-javadoc.jar b/lib/open-dis7-javadoc.jar deleted file mode 100644 index 13feb1093d169886bf4b75134debadf3ec838717..0000000000000000000000000000000000000000 Binary files a/lib/open-dis7-javadoc.jar and /dev/null differ diff --git a/lib/open-dis7-source.jar b/lib/open-dis7-source.jar deleted file mode 100644 index 9083bdab1ff543838b86fa222d998ff873efe86c..0000000000000000000000000000000000000000 Binary files a/lib/open-dis7-source.jar and /dev/null differ diff --git a/nbproject/nbjdk.properties b/nbproject/nbjdk.properties index 7fc8ad8110ca1630a2c14bc2c123b5acfe698517..3033a8abbe8c94d80e50e14c39c869aee52fbf88 100644 --- a/nbproject/nbjdk.properties +++ b/nbproject/nbjdk.properties @@ -1 +1 @@ -nbjdk.active=Open_JDK_14.0.2 +nbjdk.active=default_platform diff --git a/nbproject/project.xml b/nbproject/project.xml index 1c6ab13dbb8ab5e23e9bfffbdb691e8a6ce13002..cc787cf98ddbe463797aca941d471d42353d9e14 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -6,11 +6,11 @@ <name>Networked Graphics MV3500</name> </general-data> <general-data xmlns="http://www.netbeans.org/ns/freeform-project/2"> - <!-- Do not use Project Properties customizer when editing this file manually. - To prevent the customizer from showing, create nbproject/project.properties file and enter -auxiliary.show.customizer=false -property there. Adding -auxiliary.show.customizer.message=<message> + <!-- Do not use Project Properties customizer when editing this file manually. + To prevent the customizer from showing, create nbproject/project.properties file and enter +auxiliary.show.customizer=false +property there. Adding +auxiliary.show.customizer.message=<message> will show your customized message when someone attempts to open the customizer. --> <name>Networked Graphics MV3500</name> <properties/> diff --git a/presentations/07_NetworkScalability.pptx b/presentations/07_NetworkScalability.pptx index e87e14b138acfeea4204c4726317f88791feedbf..28bf26c20ecab765e034c1e850ffc0d770628809 100644 Binary files a/presentations/07_NetworkScalability.pptx and b/presentations/07_NetworkScalability.pptx differ diff --git a/specifications/IeeeDisPduColorFigures.pdf b/specifications/IeeeDisPduColorFigures.pdf index cc0e26046238267d8355ba34fa31225882413648..0a137b0d745e9b9e450d407a18dd2c15ba561942 100644 Binary files a/specifications/IeeeDisPduColorFigures.pdf and b/specifications/IeeeDisPduColorFigures.pdf differ diff --git a/specifications/README.md b/specifications/README.md index 984da8c081210a29130a1f8c4515fc10f4280848..544540b031becf4165593e065a9c703a47b4ba5c 100644 --- a/specifications/README.md +++ b/specifications/README.md @@ -1,16 +1,17 @@ # IEEE Distributed Interactive Simulation (DIS) Protocol -*Distributed Interactive Simulation (DIS) is an IEEE standard for conducting +*Distributed Interactive Simulation (DIS) is an +[Institute of Electrical and Electronics Engineers (IEEE)](https://www.ieee.org) standard for conducting real-time platform-level wargaming across multiple host computers and is used worldwide, especially by military organizations but also by other agencies such as those involved in space exploration and medicine.* * Wikipedia: [Distributed Interactive Simulation (DIS)](https://en.wikipedia.org/wiki/Distributed_Interactive_Simulation) IEEE Standard and [RPR FOM](https://en.wikipedia.org/wiki/RPR_FOM) * [Simulation Interoperabilty Standards Organization (SISO)](https://www.sisostds.org): "Simulation Interoperability and Reuse through Standards" -* SISO Product Support Group (PSG): [DIS / RPR FOM PSG - Distributed Interactive Simulation / Real-time Platform Reference Federation Object Model](https://www.sisostds.org/StandardsActivities/SupportGroups/DISRPRFOMPSG.aspx) +* SISO [DIS / RPR FOM PSG - Distributed Interactive Simulation / Real-time Platform Reference Federation Object Model](https://www.sisostds.org/StandardsActivities/SupportGroups/DISRPRFOMPSG.aspx) Product Support Group (PSG) ## Working-Group Resources -**DIS/RPR FOM Product Support Group** +**DIS/RPR FOM Product Support Group** <img src="SisoLogo.jpg" width="314" align="right"/> * "The Distributed Interactive Simulation / Real-time Platform Reference Federation Object Model (DIS / RPR FOM) Product Support Group (PSG) is a permanent support group chartered by the SISO Standards Activity Committee to support multiple DIS-related products." * [Distributed Interactive Simulation / Real-time Platform Reference Federation Object Model (DIS / RPR FOM) Product Support Group (PSG)](https://www.sisostds.org/StandardsActivities/SupportGroups/DISRPRFOMPSG.aspx) @@ -37,7 +38,7 @@ Data messages, known as Protocol Data Units (PDUs), that are exchanged on a netw --- -**1278.2-2015. IEEE Standard for Distributed Interactive Simulation (DIS) - Communication Services and Profiles** +**1278.2-2015. IEEE Standard for Distributed Interactive Simulation (DIS) - Communication Services and Profiles** <img src="IeeeLogo.jpg" width="120" align="right"/> * https://ieeexplore.ieee.org/document/7459689 * *Abstract.* Communication services to support information exchange between simulation applications participating in the distributed interactive simulation (DIS) environment are defined. These communication services describe a connectionless information transfer that supports real-time, as well as non-real-time, exchange. Several communication profiles specifying communication services are provided. @@ -50,7 +51,7 @@ The purpose of this standard is to establish requirements for communication subs --- -**1278.3-1996. IEEE Recommended Practice for Distributed Interactive Simulation - Exercise Management and Feedback** +**1278.3-1996. IEEE Recommended Practice for Distributed Interactive Simulation - Exercise Management and Feedback** <img src="IeeeLogo.jpg" width="120" align="right"/> * https://ieeexplore.ieee.org/document/587529 * *Abstract.* Guidelines are established for exercise management and feedback in distributed interactive simulation (DIS) exercises. Guidance is provided to sponsors, providers and supporters of DIS-compliant systems and exercises as well as to developers of DIS exercise management and feedback stations. The activities of the organizations involved in a DIS exercise and the top-level processes used to accomplish those activities are addressed. The functional requirements of the exercise management and feedback process are also addressed. This standard is one of a series of standards developed for DIS to assure interoperability between dissimilar simulations for currently installed and future simulations developed by different organizations. @@ -58,7 +59,7 @@ Guidelines are established for exercise management and feedback in distributed i --- -**4. 1278.4-1997. IEEE Recommended Practice for Distributed Interactive Simulation - Verification, Validation, and Accreditation** +**4. 1278.4-1997. IEEE Recommended Practice for Distributed Interactive Simulation - Verification, Validation, and Accreditation** <img src="IeeeLogo.jpg" width="120" align="right"/> * https://ieeexplore.ieee.org/document/8685803 * *Abstract.* Guidelines are established for the verification, validation, and accreditation (VV&A) of distributed interactive simulation (DIS) exercises. How-to procedures for planning and conducting DIS exercise VV&A are provided. Intended for use in conjunction with IEEE Std 1278.3-1996, this recommended practice presents data flow and connectivity for all proposed verification and validation activities and provides rationale and justification for each step. VV&A guidance is provided to exercise users/sponsors and developers. @@ -67,9 +68,12 @@ Guidelines are established for the verification, validation, and accreditation ( --- -**5. SISO-REF-010-2019: Reference for Enumerations for Simulation Interoperability** <img src="SisoLogo.jpg" width="314" align="right"/> -* https://www.sisostds.org/ProductsPublications/ReferenceDocuments.aspx +**5. SISO-REF-010-2020: Reference for Enumerations for Simulation Interoperability** <img src="SisoLogo.jpg" width="314" align="right"/> +* https://www.sisostds.org/ProductsPublications/ReferenceDocuments.aspx (scroll down to bottom of page) * *Abstract.* SISO-REF-010 specifies numerical values and associated definitions for fields that are identified as enumerations in SISO Standards Products and SISO-sponsored standards published by IEEE for High Level Architecture (HLA) and Distributed Interactive Simulation (DIS). Enumerations for simulations may be applied in other architectures, such as the Test and Training Enabling Architecture (TENA). +* Resources include [SISO-REF-010-2020 distribution](https://www.sisostds.org/DigitalLibrary.aspx?Command=Core_Download&EntryId=51787), +[enumerations PDF](https://www.sisostds.org/DigitalLibrary.aspx?Command=Core_Download&EntryId=46172) and +[Operations Manual (OPMAN)](https://www.sisostds.org/DigitalLibrary.aspx?Command=Core_Download&EntryId=47284) --- diff --git a/specifications/build.xml b/specifications/build.xml index c1075129222aaa183706a74a7daa481aa85db489..0b41c4cc267e615963f033243e906355befb17fd 100644 --- a/specifications/build.xml +++ b/specifications/build.xml @@ -17,18 +17,22 @@ <fileset dir="." includes="**/*.xsl"/> <fileset dir="." includes="**/Makefile"/> <fileset dir="." includes="**/README.txt"/> - <fileset dir="." includes="**/SISO-REF-010-2019*/*"/> + <fileset dir="." includes="**/SISO-REF-010-v28/*"/> </delete> - <delete verbose="true" failonerror="false" dir="SISO-REF-010-2019 Enumerations v26_files"/> + <delete verbose="true" failonerror="false" dir="SISO-REF-010-v28"/> </target> <!-- =============================================== --> <target name="download.IeeeDisStandards.rename" description="rename saved DIS specification files to readable filenames"> - <move file="6387564.pdf" tofile="IEEE1278.1-2012.DistributedInteractiveSimulation.ApplicationProtocols.6387564.pdf" verbose="true" quiet="true" failonerror="false"/> - <move file="7459689.pdf" tofile="IEEE1278.2-2015.DistributedInteractiveSimulation.CommunicationsServices.7459689.pdf" verbose="true" quiet="true" failonerror="false"/> - <move file= "587529.pdf" tofile="IEEE1278.3-2015.DistributedInteractiveSimulation.CommunicationsServices.587529.pdf" verbose="true" quiet="true" failonerror="false"/> - <move file="6595010.pdf" tofile="IEEE1278.4-2013.DistributedInteractiveSimulation.VV+A.8685803.pdf" verbose="true" quiet="true" failonerror="false"/> + <!-- part 1 6387564.pdf --> + <move file="12781-2012.pdf" tofile="IEEE1278.1-2012.DistributedInteractiveSimulation.ApplicationProtocols.12781-2012.pdf" verbose="true" quiet="true" failonerror="false"/> + <!-- part 2 7459689.pdf --> + <move file="12782-2015.pdf" tofile="IEEE1278.2-2015.DistributedInteractiveSimulation.CommunicationsServices.12782-2015.pdf" verbose="true" quiet="true" failonerror="false"/> + <!-- part 3 00587529.pdf --> + <move file= "00587529.pdf" tofile="IEEE1278.3-2015.DistributedInteractiveSimulation.CommunicationsServices.00587529.pdf" verbose="true" quiet="true" failonerror="false"/> + <!-- part 4 6595010.pdf --> + <move file="12784-1997.pdf" tofile="IEEE1278.4-2013.DistributedInteractiveSimulation.VV+A.12784-1997.pdf" verbose="true" quiet="true" failonerror="false"/> <echo message="*.pdf directory contents:"/> <!-- https://stackoverflow.com/questions/10528032/listing-all-files-and-subdirectories-using-ant --> @@ -62,6 +66,7 @@ <property name="warningMessage" value="Restriction: cookie restrictions prevent automated download. You must manually download this file while within NPS campus or firewall. For "/> <echo message="${warningMessage}IEEE1278.1 retrieval to this location, use your browser to save ${ieeeBaseLinkUrl}${DIS.1.document}" file="${DIS.1.rename}.SAVEME"/> + <echo message=""/> <!-- ======================== --> <property name="DIS.2.document" value="7459689"/> @@ -74,6 +79,7 @@ dest="${DIS.2.rename}" verbose="true"/> --> <echo message="${warningMessage}IEEE1278.2 retrieval to this location, use your browser to save ${ieeeBaseLinkUrl}${DIS.2.document}" file="${DIS.2.rename}"/> + <echo message=""/> <!-- ======================== --> <property name="DIS.3.document" value="587529"/> @@ -86,6 +92,7 @@ dest="${DIS.3.rename}" verbose="true"/> --> <echo message="${warningMessage}IEEE1278.3 retrieval to this location, use your browser to save ${ieeeBaseLinkUrl}${DIS.3.document}" file="${DIS.3.rename}"/> + <echo message=""/> <!-- ======================== --> <property name="DIS.4.document" value="8685803"/> @@ -119,7 +126,7 @@ <echo message="as ${DIS.1.rename}"/> <get src="${ieeeBaseLinkUrl}${DIS.1.document}" dest="${DIS.1.rename}" verbose="true"/> - + <!-- ======================== --> <property name="DIS.2.document" value="7459689"/> <property name="DIS.2.rename" value="IEEE1278.2-2015.DistributedInteractiveSimulation.CommunicationsServices.${DIS.2.document}.pdf"/> @@ -153,21 +160,26 @@ <property name="sisoBaseUrl" value="https://www.sisostds.org/DigitalLibrary.aspx?Command=Core_Download&EntryId="/> <target name="download.SISO"> - - <property name="SISO-REF-010" value="SISO-REF-010-v26.zip"/> - <echo message="get ${SISO-REF-010}"/> - <get src="${sisoBaseUrl}46171" - dest="${SISO-REF-010}" verbose="true"/> - <unzip src="${SISO-REF-010}" - dest="" overwrite="true"/> - <delete file="${SISO-REF-010}"/> + <property name="SISO-REF-010" value="SISO-REF-010-v28"/> + <delete dir="${SISO-REF-010}" failonerror="false"/> + <mkdir dir="${SISO-REF-010}"/> + <echo message="get ${SISO-REF-010}.zip from"/> + <echo message=" ${sisoBaseUrl}51787"/> + <get src="${sisoBaseUrl}51787" + dest="${SISO-REF-010}.zip" verbose="true"/> + <unzip src="${SISO-REF-010}.zip" + dest="${SISO-REF-010}" overwrite="true"/> + <delete file="${SISO-REF-010}.zip"/><!-- no longer needed --> - <!-- duplicative, already contained in preceding zip + <!-- ensure not duplicative and already contained in preceding zip --> <property name="SISO-REF-010.1" value="SISO-REF-010.1-2019 Operations Manual for EWG V08.pdf"/> - <echo message="get ${SISO-REF-010.1}"/> - <get src="${sisoBaseUrl}46173" - dest="${SISO-REF-010.1}" verbose="true"/> - --> + <echo message="get ${SISO-REF-010.1}"/> + <echo message="from ${sisoBaseUrl}47284"/> + <echo message="as ${SISO-REF-010}/${SISO-REF-010.1}"/> + <get src="${sisoBaseUrl}47284" + dest="${SISO-REF-010}" verbose="true"/> + <echo message="fix download filename"/> + <move file="${SISO-REF-010}/DigitalLibrary.aspx" tofile="${SISO-REF-010}/${SISO-REF-010.1}" overwrite="true" verbose="true"/> </target>