diff --git a/assignments/src/MV3500Cohort2021JulySeptember/README.md b/assignments/src/MV3500Cohort2021JulySeptember/README.md index 316bc6f58a16edec303f63f10893f95bab6fa051..a13411e0f1d7e149698a929221783c5ee43d4634 100644 --- a/assignments/src/MV3500Cohort2021JulySeptember/README.md +++ b/assignments/src/MV3500Cohort2021JulySeptember/README.md @@ -3,7 +3,8 @@ * [Homework 1 README](homework1/README.md) * [Homework 2 README](homework2/README.md) * [Homework 3 README](homework3/README.md) -* [Homework 4 README](homework4/README.md) +* [Homework 4 README](homework4/README.md) (cancelled) +* [Projects README](projects/README.md) Please see the [README.md](../../../README.md) in the parent -[assignments](../../../../assignments) directory for detailed instructions. \ No newline at end of file +[assignments](../../../../assignments) directory for detailed instructions. diff --git a/assignments/src/MV3500Cohort2021JulySeptember/homework2/Domonique/HittnerDTcpExample3Client.java b/assignments/src/MV3500Cohort2021JulySeptember/homework2/Domonique/HittnerDTcpExample3Client.java new file mode 100644 index 0000000000000000000000000000000000000000..fcfe2b131702176adf08e604b2b7e646320275be --- /dev/null +++ b/assignments/src/MV3500Cohort2021JulySeptember/homework2/Domonique/HittnerDTcpExample3Client.java @@ -0,0 +1,87 @@ +package MV3500Cohort2021JulySeptember.homework2.Domonique; +import java.io.*; +import java.net.*; + +/** + * Hey why not say what this thing does... + * @author Dom Hittner + */ +public class HittnerDTcpExample3Client { + + /** IPv6 String constant for localhost address, similarly IPv4 127.0.0.1 + * @see <a href="https://en.wikipedia.org/wiki/localhost">https://en.wikipedia.org/wiki/localhost</a> + * @see <a href="https://en.wikipedia.org/wiki/IPv6_address">https://en.wikipedia.org/wiki/IPv6_address</a> + */ + public final static String LOCALHOST = "0:0:0:0:0:0:0:1"; + + /** + * Program invocation, execution starts here + * @param args command-line arguments + * @throws java.lang.InterruptedException user can cancel execution + */ + public static void main(String[] args) throws InterruptedException { + + // Local variables/fields + Socket socket = null; + InputStream is; + Reader isr; + BufferedReader br; + String serverMessage; + int clientLoopCount = 0; + + try { + while (true) + { + clientLoopCount++; // increment at beginning of loop for reliability + System.out.println(HittnerDTcpExample3Client.class.getName() + " creating socket..."); + + // We request an IP to connect to ("localhost") and + // port number at that IP (2317). This establishes + // a connection to that IP in the form of a Socket + // object; the server uses a ServerSocket to wait for + // connections. + socket = new Socket(LOCALHOST, 2317); // locohost? + + // Now hook everything up (i.e. set up the streams), Java style: + is = socket.getInputStream(); + isr = new InputStreamReader(is); + br = new BufferedReader(isr); + + // Read a single line written by the server. We'd + // do things a bit differently if there were many lines to be read + // from the server instead of one only. + serverMessage = br.readLine(); + System.out.println("=================================================="); + +// System.out.print ("Client loop " + clientLoopCount + ": "); + System.out.println("I am hungry"); + System.out.println("The message the server sent was: '" + serverMessage + "'"); + // socket gets closed, either automatically/silently by this code (or possibly by the server) + + Thread.sleep(500l); // slow things down, for example 500l (long) = 500 msec (1/2 second) + + } // end while(true) // infinite loops are dangerous, be sure to kill this process! + } + catch (IOException e) + { + System.err.println("Problem with " + HittnerDTcpExample3Client.class.getName() + " networking:"); // describe what is happening + System.err.println("Error: " + e); + + // Provide more helpful information to user if exception occurs due to running twice at one time + if (e instanceof java.net.BindException) { + System.err.println("*** Be sure to stop any other running instances of programs using this port!"); + } + } + 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(HittnerDTcpExample3Client.class.getName() + " exit"); + } + } +} \ No newline at end of file diff --git a/assignments/src/MV3500Cohort2021JulySeptember/homework2/Domonique/HittnerDTcpExampleServer.java b/assignments/src/MV3500Cohort2021JulySeptember/homework2/Domonique/HittnerDTcpExampleServer.java new file mode 100644 index 0000000000000000000000000000000000000000..610a9a7dccb332fb42a068f12ed77f243915cd23 --- /dev/null +++ b/assignments/src/MV3500Cohort2021JulySeptember/homework2/Domonique/HittnerDTcpExampleServer.java @@ -0,0 +1,88 @@ +package MV3500Cohort2021JulySeptember.homework2.Domonique; + +import java.io.*; +import java.net.*; + +/** + * + * @author Dom Hittner + */ +public class HittnerDTcpExampleServer { + + /** + * Program invocation, execution starts here + * If already compiled, can run using console in directory ../../build/classes/ by invoking \ + * java -classpath . TcpExamples.TcpExample3Server + * @param args command-line arguments + */ + public static void main(String[] args) { + try { + + // ServerSocket waits for a connection from a client. + // Notice that it is outside the loop; ServerSocket + // needs to be made only once. + System.out.println(HittnerDTcpExampleServer.class.getName() + " has started..."); // it helps debugging to put this on console first + + ServerSocket serverSocket = new ServerSocket(2317); + OutputStream os; + PrintStream ps; + InetAddress localAddress, remoteAddress; + int localPort, remotePort; + int serverLoopCount = 0; + + // Server is up and waiting (i.e. "blocked" or paused) + // Loop, infinitely, waiting for client connections. + // Stop the program somewhere else. + while (true) { + + // block until connected to a client + try (Socket clientConnectionSocket = serverSocket.accept()) + { + serverLoopCount++; // increment at beginning of loop for reliability + + // Now hook everything up (i.e. set up the streams), Java style: + os = clientConnectionSocket.getOutputStream(); + ps = new PrintStream(os); + ps.println("okay " + serverLoopCount + " let's go to Starbucks"); // this gets sent back to client! + + // Print some information locally about the Socket connection. + // This includes the port and IP numbers on both sides (the socket pair). + localAddress = clientConnectionSocket.getLocalAddress(); + remoteAddress = clientConnectionSocket.getInetAddress(); + localPort = clientConnectionSocket.getLocalPort(); + remotePort = clientConnectionSocket.getPort(); + + System.out.print ("Server loop " + serverLoopCount + ": "); + + // My socket pair connection looks like this, to localhost: + // Socket pair: (( /0:0:0:0:0:0:0:1, 2317 ), ( /0:0:0:0:0:0:0:1, 54876 )) + // Socket pair: (( /0:0:0:0:0:0:0:1, 2317 ), ( /0:0:0:0:0:0:0:1, 54881 )) + + // Why is the first IP/port the same, while the second set has different ports? + System.out.println(HittnerDTcpExampleServer.class.getName() + " socket pair showing host name, address, port:"); + System.out.println(" (( " + + localAddress.getHostName() + "=" + localAddress.getHostAddress() + ", " + localPort + " ), ( " + + remoteAddress.getHostName() + "=" + remoteAddress.getHostAddress() + ", " + remotePort + " ))"); + + if ( localAddress.getHostName().equals( localAddress.getHostAddress()) || + remoteAddress.getHostName().equals(remoteAddress.getHostAddress())) + System.out.println(" note HostName matches address if host has no DNS name"); + + // Notice the use of flush() and try w/ resources. Without + // the try w/ resources the Socket object may stay open for + // a while after the client has stopped needing this + // connection. try w/ resources explicitly ends the connection. + ps.flush(); + // like it or not, you're outta here! + } + } + } catch (IOException e) { + System.err.println("Problem with " + HittnerDTcpExampleServer.class.getName() + " networking: " + e); + + // Provide more helpful information to user if exception occurs due to running twice at one time + if (e instanceof java.net.BindException) { + System.err.println("*** Be sure to stop any other running instances of programs using this port!"); + } + } + } +} diff --git a/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankClient.java b/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankClient.java index 1e8440366cc60797eb19efcdc0f48a358bbbdf2b..16f36fbb9a83d95cbf03edeff9ea0e9fc82f8b40 100644 --- a/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankClient.java +++ b/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankClient.java @@ -15,7 +15,12 @@ import java.net.Socket; * and open the template in the editor. */ /** - * + *This is assignment 2 were I modified TCP example 3 + * If server message is = "this is good bye message from Franks server" the client terminates + * Changed the local host 2318 + * Changed the sleep to 1 second + * Received a message from the server "How are you doing" + * Client sends a message to the server " I'm doing well" * @author justi */ public class FrankClient { @@ -26,7 +31,7 @@ public class FrankClient { /** * Program invocation, execution starts here - * + * If client receives m * @param args command-line arguments * @throws java.lang.InterruptedException user cancels execution */ diff --git a/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankServer.java b/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankServer.java index 864516dda793c18c1d042be86e063df40a433e6c..4a8df221fd4915e8d02f6212415e1d1c2bbc9978 100644 --- a/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankServer.java +++ b/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankServer.java @@ -4,16 +4,19 @@ import java.io.*; import java.net.*; + +/** + *This is assignment 2 were I modified TCP example 3 + * I set sever loop count 10 and terminates after 10 loops + * sends a message to the client ""this is good bye message from Franks server" + * Sent a message to client "How are you doing" + * Receives a message from the client "I'm doing well"! + * @author justi + */ + public class FrankServer { - /** - * Program invocation, execution starts here If already compiled, can run - * using console in directory ../../build/classes/ by invoking \ java - * -classpath .TcpExamples.TcpExample3Server - * - * @param args command-line arguments - * @throws java.lang.InterruptedException user cancels execution - */ + public static void main(String[] args) throws InterruptedException { try { @@ -48,7 +51,7 @@ public class FrankServer { if (serverLoopCount <= 10) { // checking if the loop count <= 10 ps.println("How are you doing?"); // this gets sent back to client! } else { - ps.println("this is good bye message from Franks server"); // termination after 20 messages + ps.println("this is good bye message from Franks server"); // termination after 10 messages break; // Stop server } // Print some information locally about the Socket connection. diff --git a/assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNickTcpExample3Client.java b/assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNick/HittnerNickTcpExample3Client.java similarity index 98% rename from assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNickTcpExample3Client.java rename to assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNick/HittnerNickTcpExample3Client.java index a5ef04e793db41b04a9ffcaa0ea6419eb4594292..4490630bf4418b5d0e6ef9d7f6b9f01f9bb2ac8d 100644 --- a/assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNickTcpExample3Client.java +++ b/assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNick/HittnerNickTcpExample3Client.java @@ -1,4 +1,4 @@ -package MV3500Cohort2021JulySeptember.homework2; +package MV3500Cohort2021JulySeptember.homework2.HittnerNick; import java.io.*; import java.net.*; diff --git a/assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNickTcpExample3Server.java b/assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNick/HittnerNickTcpExample3Server.java similarity index 98% rename from assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNickTcpExample3Server.java rename to assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNick/HittnerNickTcpExample3Server.java index 1739a997b408eb424ac6301e3c3a1219b7d03636..3c59c1895b02cce7f001010293c059a9d7ee5134 100644 --- a/assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNickTcpExample3Server.java +++ b/assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNick/HittnerNickTcpExample3Server.java @@ -1,4 +1,4 @@ -package MV3500Cohort2021JulySeptember.homework2; +package MV3500Cohort2021JulySeptember.homework2.HittnerNick; import java.io.*; import java.net.*; diff --git a/assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNickUmlSequenceDiagram.pdf b/assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNick/HittnerNickUmlSequenceDiagram.pdf similarity index 100% rename from assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNickUmlSequenceDiagram.pdf rename to assignments/src/MV3500Cohort2021JulySeptember/homework2/HittnerNick/HittnerNickUmlSequenceDiagram.pdf diff --git a/assignments/src/MV3500Cohort2021JulySeptember/homework3/Leckie/PushTest.java b/assignments/src/MV3500Cohort2021JulySeptember/homework3/Leckie/PushTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f833e7c85fb8ff37c28b3fa1b00ca6c13c2fa39e --- /dev/null +++ b/assignments/src/MV3500Cohort2021JulySeptember/homework3/Leckie/PushTest.java @@ -0,0 +1,19 @@ + +package MV3500Cohort2021JulySeptember.homework3.Leckie; + +/** + * + * @author User + */ + + +public class PushTest { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + } + +} diff --git a/assignments/src/MV3500Cohort2021JulySeptember/homework3/README.md b/assignments/src/MV3500Cohort2021JulySeptember/homework3/README.md index db68d33e7beceb8bb9a9b183927b859ddf63e79a..db254434a0045cb154422ba01f88c7e47cac42b7 100644 --- a/assignments/src/MV3500Cohort2021JulySeptember/homework3/README.md +++ b/assignments/src/MV3500Cohort2021JulySeptember/homework3/README.md @@ -1,30 +1,31 @@ -## Homework 3: Recording OpenDIS Network Streams +## Homework 3: Example Simulation Recording OpenDIS Network Streams -### Prior Assignment, August 2019 - -In 2019, students worked together on a single project to check wireless multicast connectivity recently deployed on NPS campus. - -See their experimental results in the [NPS Multicast Connectivity Report](../../MV3500Cohort2019JulySeptember/homework3). +### Assignment -### (draft) Assignment +* Adapt the functionality for [OpenDIS ExampleSimulationProgram](../../../../examples/src/OpenDis7Examples/ExampleSimulationProgram.java), modifying provided code +* Result streams are recorded/saved/replayed using Wireshark or X3D-Edit. -* Adapt the functionality for OpenDIS PDU Track Sender, modifying provided code -* Result streams are recorded/saved/replayed using X3D-Edit or Wireshark. +This assignment presents a Problem Prototyping opportunity. +While some minimal functionality is expected, the general outline of +a networking problem and proposed solution holds great interest. +Think of it as a warmup preparation for your final project. -*Freeplay opportunity!* Pick one of the provided course example programs -(single or multiple source files) and adapt it to demonstrate a new -client-server handshake protocol of interest. +This is also a freeplay opportunity. + You have the option to pick one or more of the provided course example programs +and adapt the source to demonstrate a new client-server handshake protocol of interest. Be sure to provide a rationale that justifies why the networking choices you made (TCP/UDP, unicast/multicast, etc.) are the best for the problem you are addressing. -This assignment is also a Problem Prototyping opportunity. -While some minimal functionality is expected, the general outline of -a networking problem and proposed solution holds great interest. -Think of it as a warmup preparation for your final project. - Refer to [homework2 README](../homework2/README.md) and [assignments README](../../../README.md) for further details on what specific deliverables are expected in each homework assignment. -Team efforts are allowed, though if you choose a team approach be sure to justify why. +Team efforts are encouraged, though if you choose a team approach be sure to justify why. This is a good warmup prior to final projects. Have fun with Java networking! + +### Prior Assignment, August 2019 + +In 2019, students worked together on a single project to check wireless multicast connectivity recently deployed on NPS campus. + +See their experimental results in the [NPS Multicast Connectivity Report](../../MV3500Cohort2019JulySeptember/homework3). + diff --git a/assignments/src/MV3500Cohort2021JulySeptember/projects/.gitkeep b/assignments/src/MV3500Cohort2021JulySeptember/projects/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/assignments/src/MV3500Cohort2021JulySeptember/projects/README.md b/assignments/src/MV3500Cohort2021JulySeptember/projects/README.md new file mode 100644 index 0000000000000000000000000000000000000000..44f11bf4243f2000e55e5f2544d8c7d22d47a9be --- /dev/null +++ b/assignments/src/MV3500Cohort2021JulySeptember/projects/README.md @@ -0,0 +1,14 @@ +## Final Course Projects 2021JulySeptember + +Create a dedicated subdirectory for each individual or team project. + +Example: `SmithJones` + +See the [course syllabus](../../../../MV3500NetworkedGraphicsSyllabus2021JulySeptember.pdf) for details on how to document your project. + +Typical final project deliverables: +* `README.MyProject.md` providing a basic description of goals, running the project, files, etc. +* Source code, screen shots, console text log, and any other assets +* Powerpoint presentation, video capture (if you want) + +These deliverables have excellent value going forward, hopefully benefiting your thesis efforts as well. Questions welcome, keep going! diff --git a/examples/src/OpenDis7Examples/README.md b/examples/src/OpenDis7Examples/README.md index 13f02dc8e06baab2d76610f2649a3745a653e84a..21dbbf78135d24871426283be1f8f4e6a2632c09 100644 --- a/examples/src/OpenDis7Examples/README.md +++ b/examples/src/OpenDis7Examples/README.md @@ -1,6 +1,6 @@ # DIS Protocol Examples using Open-DIS-Java Library v7 -All examples tested, TODO PduReaderPlayer operation still needs debugging. +All examples tested, running and documented satisfactorily. Course examples using the [Open-DIS-Java](https://github.com/open-dis/open-dis-java) library are presented in this package.