Skip to content
Snippets Groups Projects
Commit 900e79c7 authored by rojas's avatar rojas
Browse files

Merge origin/master

Conflicts:
	assignments/nbproject/build-impl.xml
	assignments/nbproject/project.properties
	examples/nbproject/build-impl.xml
parents 1b018ffa 671f8450
No related branches found
No related tags found
No related merge requests found
Showing
with 388 additions and 10491 deletions
......@@ -4,6 +4,7 @@
**/build-impl.xml
**/build-impl.xml~
**/private/
**/.DS_Store
/assignments/build/
/assignments/dist/
......
No preview for this file type
No preview for this file type
......@@ -20,15 +20,15 @@ Additional course pages:
References and resources:
* [GitLab Flavored Markdown (GFM)](https://docs.gitlab.com/ee/user/markdown.html)
* [Java Archive (.jar)](https://docs.oracle.com/javase/tutorial/deployment/jar/basicsindex.html) for sharable/runnable software libraries
* [Java SE JDK download](https://openjdk.java.net) (OpenJDK 21.0.1) or
[Java SE JDK download](https://www.oracle.com/technetwork/java/javase/downloads/index.html) (OracleJDK 20)
* [Netbeans](http://www.netbeans.org) (version 19), [Using Git Support in NetBeans IDE](https://netbeans.org/kb/docs/ide/git.html)
* [Java SE OpenJDK download](https://openjdk.java.net) (OpenJDK 22) or
[Java SE JDK download](https://www.oracle.com/technetwork/java/javase/downloads/index.html) (OracleJDK 22)
* [Netbeans](http://www.netbeans.org) (version 22), [Using Git Support in NetBeans IDE](https://netbeans.org/kb/docs/ide/git.html)
and [Video of Cloning a Git Repository Using NetBeans IDE](https://netbeans.org/kb/docs/ide/git_nb_ssh_screencast.html)
* [Open-DIS Repository](https://github.com/open-dis) (specifically [opendis7-java](https://github.com/open-dis/opendis7-java)) and [Distributed Interactive Simulation: The Missing Handbook](https://github.com/open-dis/DISTutorial/blob/master/README.md)
* [Savage Developers Guide](https://savage.nps.edu/Savage/developers.html) resources for [Cygwin](https://savage.nps.edu/Savage/developers.html#Cygwin), [DIS](https://savage.nps.edu/Savage/developers.html#DIS) and [telnet](https://savage.nps.edu/Savage/developers.html#telnet)
* [Sequence Diagram](https://en.wikipedia.org/wiki/Sequence_diagram) and [Timing Diagram (UML)](https://en.wikipedia.org/wiki/Timing_diagram_(Unified_Modeling_Language)) on Wikipedia
* [WireShark](https://wireshark.org) and [WireShark Tutorial for Beginners](https://www.youtube.com/watch?v=TkCSr30UojM) video by Anson Alexander
* [X3D-Edit](https://savage.nps.edu/X3D-Edit) as Netbeans Plugin including [DIS PDU Player/Recorder](https://savage.nps.edu/X3D-Edit/images/DisPlayerRecorderPanel.png) and [ESPDU Generator](https://savage.nps.edu/X3D-Edit/images/DisEspduTestPanelDemo.png) (currently uses NetBeans version 22)
* [X3D-Edit](https://savage.nps.edu/X3D-Edit) as Netbeans Plugin including [DIS PDU Player/Recorder](https://savage.nps.edu/X3D-Edit/images/DisPlayerRecorderPanel.png) and [ESPDU Generator](https://savage.nps.edu/X3D-Edit/images/DisEspduTestPanelDemo.png) (updated quarterly to use latest NetBeans version)
* [X3D for Web Authors](https://x3dgraphics.com) book, examples and slidesets including [X3D Distributed Interactive Simulation (DIS)](https://x3dgraphics.com/slidesets/X3dForAdvancedModeling/DistributedInteractiveSimulation.pdf)
Contact: Don Brutzman, brutzman@nps.edu
......@@ -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="MV3302" default="default" basedir=".">
<project name="Networked Graphics MV3500 examples MV3302" default="default" basedir=".">
<description>Builds, tests, and runs the project MV3302.</description>
<import file="nbproject/build-impl.xml"/>
<!--
......
This diff is collapsed.
File deleted
This diff is collapsed.
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
# Avoid compilation or inclusion of student project depending on mutex libraries only available in JDK8
# https://stackoverflow.com/questions/27906896/exclude-package-from-build-but-not-from-view-in-netbeans-8
excludes=**/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/**
dist.archive.excludes=**/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/**
# 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=
file.reference.dis-enums-1.3.jar=../lib/dis-enums-1.3.jar
file.reference.opendis7-full.jar=../lib/opendis7-full.jar
file.reference.open-dis_4.16.jar=../lib/open-dis_4.16.jar
file.reference.simkit-doc.zip=../lib/simkit-doc.zip
file.reference.simkit-src.zip=../lib/simkit-src.zip
file.reference.simkit.jar=../lib/simkit.jar
#file.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-classes.jar
#file.reference.opendis7-pdus-classes.jar=../lib/opendis7-pdus-classes.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${file.reference.opendis7-full.jar}:\
${file.reference.dis-enums-1.3.jar}:\
${file.reference.open-dis_4.16.jar}:\
${file.reference.simkit-doc.zip}:\
${file.reference.simkit-src.zip}:\
${file.reference.simkit.jar}
# ${file.reference.opendis7-enumerations-classes.jar}:\
# ${file.reference.opendis7-pdus-classes.jar}:\
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:deprecation -Xlint:unchecked
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=22
javac.target=22
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=-header "NPS Networked Graphics MV3500 Assignments"
javadoc.author=true
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
#javadoc.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-javadoc.jar
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=MV3500 Assignments
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=MV3500Cohort2022MayJune.homework2.Royer.Homework2.java
# 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=JDK_22
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.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-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
# Avoid compilation or inclusion of student project depending on mutex libraries only available in JDK8
# https://stackoverflow.com/questions/27906896/exclude-package-from-build-but-not-from-view-in-netbeans-8
excludes=**/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/**
dist.archive.excludes=**/MV3500Cohort2019JulySeptember/projects/BrennenstuhlKnobelochMcCann/**
# 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=
file.reference.dis-enums-1.3.jar=../lib/dis-enums-1.3.jar
file.reference.opendis7-full.jar=../lib/opendis7-full.jar
file.reference.open-dis_4.16.jar=../lib/open-dis_4.16.jar
file.reference.simkit-doc.zip=../lib/simkit-doc.zip
file.reference.simkit-src.zip=../lib/simkit-src.zip
file.reference.simkit.jar=../lib/simkit.jar
#file.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-classes.jar
#file.reference.opendis7-pdus-classes.jar=../lib/opendis7-pdus-classes.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${file.reference.opendis7-full.jar}:\
${file.reference.dis-enums-1.3.jar}:\
${file.reference.open-dis_4.16.jar}:\
${file.reference.simkit-doc.zip}:\
${file.reference.simkit-src.zip}:\
${file.reference.simkit.jar}
# ${file.reference.opendis7-enumerations-classes.jar}:\
# ${file.reference.opendis7-pdus-classes.jar}:\
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:deprecation -Xlint:unchecked
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=20
javac.target=20
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=-header "NPS Networked Graphics MV3500 Assignments"
javadoc.author=true
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
#javadoc.reference.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-javadoc.jar
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=MV3500 Assignments
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=MV3500Cohort2022MayJune.homework2.Royer.Homework2.java
# 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.opendis7-enumerations-classes.jar=../lib/opendis7-enumerations-source.jar
src.dir=src
test.src.dir=test
File deleted
File deleted
File deleted
package MV3500Cohort2024JulySeptember.homework2.Timberlake;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;
/**
*
* @author Jack
*/
public class Client_HW2 {
public static void main(String[] args) {
DatagramSocket socket = null;
Scanner scanner = new Scanner(System.in);
try {
// Create a socket to communicate with the server
socket = new DatagramSocket();
InetAddress serverAddress = InetAddress.getByName("localhost"); // Server address (localhost for testing)
byte[] sendData = new byte[1024]; // Buffer to store data to send
byte[] receiveData = new byte[1024]; // Buffer to store received data
System.out.print("Let's play a game!!\n");
System.out.print("Try guessing a number between 1-100\n");
while(true) {
System.out.print("Enter your guess: ");
String guess = scanner.nextLine(); //Read user input
sendData = guess.getBytes(); // Convert message to bytes
// Send guess to the server
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, serverAddress, 9876);
socket.send(sendPacket); // Send packet to server
// Receive response from server
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
socket.receive(receivePacket); // Blocking call until a packet is received
String response = new String(receivePacket.getData(), 0, receivePacket.getLength());
System.out.println("Server Said: " + response); // Print received response
if (response.startsWith ("Good")) {
break; //End the game
}
}
} catch (Exception e) {
e.printStackTrace(); // Print any exceptions that occur
} finally {
if (scanner != null) {
scanner.close(); // Close scanner
}
if (socket != null && !socket.isClosed()) {
socket.close(); // Close the socket to release resources
}
}
}
}
package MV3500Cohort2024JulySeptember.homework2.Timberlake;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Random;
/**
*
* @author Jack
*/
public class Server_HW2 {
public static void main(String[] args) {
DatagramSocket socket = null;
Random random = new Random();
int numToGuess = random.nextInt(100) + 1;
//System.out.println("Magic Number Is: " + numToGuess);
try {
// Create a socket to listen on port 9876
socket = new DatagramSocket(9876);
byte[] receiveData = new byte[1024]; // Buffer to store incoming data
byte[] sendData = new byte[1024]; // Buffer to store outgoing data
int count = 1;
System.out.println("Server has started, waiting for client...");
boolean isRunning = true;
while (isRunning) {
// Receive packet from client
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
socket.receive(receivePacket); // Blocking call until a packet is received
String message = new String(receivePacket.getData(), 0, receivePacket.getLength()); //Receive packet
InetAddress clientAddress = receivePacket.getAddress(); //Save IP for response
int clientPort = receivePacket.getPort(); //Save port for response
System.out.println("Client sent: " + message); // Print received message
String response;
try {
int guess = Integer.parseInt(message.trim());
if (guess < numToGuess) {
response = "Guess Higher";
count++;
} else if (guess > numToGuess) {
response = "Guess Lower";
count++;
} else {
response = "Good Job!! That took you " + count + " tries!";
isRunning = false;
}
} catch (NumberFormatException e) {
response = "Invalid input. Enter a number.";
}
// Prepare response to client
sendData = response.getBytes(); // Convert response message to bytes
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, clientAddress, clientPort);
socket.send(sendPacket); // Send response packet to client
}
} catch (Exception e) {
e.printStackTrace(); // Print any exceptions that occur
} finally {
if (socket != null && !socket.isClosed()) {
socket.close(); // Close the socket to release resources
}
}
}
}
package MV3500Cohort2024JulySeptember.homework2.Williams;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;
/**
* Client file for HW2.
*
* @author ethanjwilliams
*/
public class HW2Client {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
DatagramSocket socket = null;
Scanner scanner = new Scanner(System.in);
try {
socket = new DatagramSocket();
InetAddress serverAddress = InetAddress.getByName("localhost");
byte[] sendData = new byte[1024];
byte[] receiveData = new byte[1024];
System.out.print("Can you solve my riddle??\n");
System.out.print("Try to solve the riddle: I speak without a mouth and hear without ears. I have no body, but I come alive with wind. What am I?\n");
while (true) {
System.out.print("Enter your answer: ");
String answer = scanner.nextLine();
sendData = answer.getBytes();
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, serverAddress, 9876);
socket.send(sendPacket);
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
socket.receive(receivePacket);
String response = new String(receivePacket.getData(), 0, receivePacket.getLength());
System.out.println("Server Said: " + response);
if (response.startsWith("Good")) {
break;
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (scanner != null) {
scanner.close();
}
if (socket != null && !socket.isClosed()) {
socket.close();
}
}
}
}
package MV3500Cohort2024JulySeptember.homework2.Williams;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
/**
* Server file for HW2.
*
* @author ethanjwilliams
*/
public class HW2Server {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
DatagramSocket socket = null;
String riddleAnswer = "echo";
try {
socket = new DatagramSocket(9876);
byte[] receiveData = new byte[1024];
byte[] sendData = new byte[1024];
int count = 1;
System.out.println("Server has started, waiting for client...");
boolean isRunning = true;
while (isRunning) {
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
socket.receive(receivePacket);
String message = new String(receivePacket.getData(), 0, receivePacket.getLength());
InetAddress clientAddress = receivePacket.getAddress();
int clientPort = receivePacket.getPort();
System.out.println("Client sent: " + message);
String response;
if (message.trim().equalsIgnoreCase(riddleAnswer)) {
response = "Good Job!! You solved the riddle in " + count + " tries!";
isRunning = false;
} else {
response = "Wrong answer. Try again!";
count++;
}
sendData = response.getBytes();
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, clientAddress, clientPort);
socket.send(sendPacket);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (socket != null && !socket.isClosed()) {
socket.close();
}
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment