diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework1/Smith/HomeworkClient.java b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Smith/HomeworkClient.java index 647cccf4c9c95997aac640307aad13ac5742512f..3fb128ec7a70d884b6029e268303574a1f7e9da5 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework1/Smith/HomeworkClient.java +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Smith/HomeworkClient.java @@ -4,14 +4,28 @@ import java.io.*; import java.net.*; import java.util.Scanner; +/** + * Client constructor + */ public class HomeworkClient { + + /** + * Client constructor + */ public HomeworkClient() { // default constructor } + /** + * local host + */ public final static String LOCALHOST = "0:0:0:0:0:0:0:1"; - public static void main(String[] args) { + /** + * Client constructor + * @param args passed in args + */ + public static void main(String[] args) { Socket socket = null; InputStream is; Reader isr; @@ -19,7 +33,7 @@ public class HomeworkClient { PrintWriter pw; String serverMessage; int clientLoopCount = 0; - + Scanner scanner = new Scanner(System.in); try { @@ -42,26 +56,28 @@ public class HomeworkClient { serverMessage = br.readLine(); System.out.println("=================================================="); - + System.out.print("Client loop " + clientLoopCount + ": "); System.out.println("now we're talking!"); System.out.println("The message the server sent was: '" + serverMessage + "'"); - + Thread.sleep(500l); } } catch (IOException | InterruptedException e) { System.err.println("Problem with " + HomeworkClient.class.getName() + " networking:"); System.err.println("Error: " + e); - + if (e instanceof java.net.BindException) { System.err.println("*** Be sure to stop any other running instances of programs using this port!"); } } finally { try { - if (socket != null) + if (socket != null) { socket.close(); - } catch (IOException e) {} - + } + } catch (IOException e) { + } + System.out.println(); System.out.println(HomeworkClient.class.getName() + " exit"); } diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework1/Smith/HomeworkServer.java b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Smith/HomeworkServer.java index ddd572c363fe9895d192967ac7ca6968eee13cd1..db85339aed9767fb01d98f6f0d8855d4963707f9 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework1/Smith/HomeworkServer.java +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Smith/HomeworkServer.java @@ -1,16 +1,26 @@ - package MV3500Cohort2024JulySeptember.homework1.Smith; import java.io.*; import java.net.*; +/** + * Sever constructor + */ public class HomeworkServer { + private static int runningTotal = 0; // Initialize running total + /** + * Sever constructor + */ public HomeworkServer() { // default constructor } + /** + * main + * @param args passed in args + */ public static void main(String[] args) { try { System.out.println(HomeworkServer.class.getName() + " has started..."); @@ -31,13 +41,13 @@ public class HomeworkServer { // Read the number sent by the client BufferedReader br = new BufferedReader(new InputStreamReader(clientConnectionSocket.getInputStream())); int clientNumber = Integer.parseInt(br.readLine()); - + // Update the running total int clientNumnerSqr = clientNumber * clientNumber; runningTotal += clientNumber; // Send back the updated total - ps.println("Client sent: " + clientNumber + ", client number squared was: "+ clientNumnerSqr+", Running total: " + runningTotal); + ps.println("Client sent: " + clientNumber + ", client number squared was: " + clientNumnerSqr + ", Running total: " + runningTotal); System.out.println("Client sent: " + clientNumber + ", Running total: " + runningTotal); localAddress = clientConnectionSocket.getLocalAddress(); @@ -47,13 +57,14 @@ public class HomeworkServer { System.out.print("Server loop " + serverLoopCount + ": "); System.out.println(HomeworkServer.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"); + 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"); + } ps.flush(); } } @@ -66,4 +77,3 @@ public class HomeworkServer { } } } - diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework1/Smith/package-info.java b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Smith/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..c307bc8da3da2485d4e802024e9f893188bec1d0 --- /dev/null +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Smith/package-info.java @@ -0,0 +1,10 @@ +/** + * TCP Unicast homework assignments supporting the NPS MOVES MV3500 Networked Graphics course. + * + * @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/assignments" target="_blank">networkedGraphicsMV3500 assignments</a> + * @see java.lang.Package + * @see <a href="https://stackoverflow.com/questions/22095487/why-is-package-info-java-useful" target="_blank">StackOverflow: why-is-package-info-java-useful</a> + * @see <a href="https://stackoverflow.com/questions/624422/how-do-i-document-packages-in-java" target="_blank">StackOverflow: how-do-i-document-packages-in-java</a> + */ + +package MV3500Cohort2024JulySeptember.homework1.Smith; diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework1/Timberlake/Client.java b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Timberlake/Client.java index d905f89d60ba8046d823ca966cca61692c9f8bd0..e5e366e17270abd2283a21941efae98e0ab2b981 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework1/Timberlake/Client.java +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Timberlake/Client.java @@ -6,10 +6,56 @@ import java.net.InetAddress; import java.util.Scanner; /** - * - * @author Jack + * <p> + * The simplest TCP network program, opening a socket between a client and server + * and send a message from the client to the server. + * It listens for any socket connection response, either from telnet (telnet localhost 2317) + * or another client program. + * Once a socket connection is established, the client sends messages to the + * server and the server echos the message back to the client. + * + * <p> + * As an alternative to running the Windows (or other operating system) console, + * you can instead run the NetBeans terminal window. If you are on Windows, + * NetBeans is looking for Cygwin installation (for Unix-like compatibility) + * with details at <a href="https://savage.nps.edu/Savage/developers.html#Cygwin" target="blank">Savage Developers Guide: Cygwin</a>. + * Modifying this program is the basis for Assignment 1. + * </p> + + * <p> + * Notice that "Client Received" matches + * what is written by the code below, over the output stream. + * </p> + * * <p> + * Notice that "Server Received" matches the string sent by the client. + * </p> + * <p> + * After the echoed message is received by the client, the program exits. + * For example: + * Enter message to send to server: hello + * Client received: Hello From Server, I received: hello + * [Program Exits] + * </p> + * + * @see <a href="../../../src/TcpExamples/TcpExample1TerminalLog.txt" target="_blank">TcpExample1TerminalLog.txt</a> + * @see <a href="../../../src/TcpExamples/TcpExample1NetBeansConsoleTelnet.png" target="_blank">TcpExample1NetBeansConsoleTelnet.png</a> + * @see <a href="../../../src/TcpExamples/TcpExample1NetBeansConsoleTelnet.pdf" target="_blank">TcpExample1NetBeansConsoleTelnet.pdf</a> + * @see <a href="../../../src/TcpExamples/TcpExample1ScreenshotNetcat.png" target="_blank">TcpExample1ScreenshotNetcat.png</a> + * @see <a href="../../../src/TcpExamples/TcpExample1ScreenshotTelnet.png" target="_blank">TcpExample1ScreenshotTelnet.png</a> + * @see <a href="https://savage.nps.edu/Savage/developers.html#Cygwin" target="blank">Savage Developers Guide: Cygwin</a> + * @see <a href="https://savage.nps.edu/Savage/developers.html#telnet" target="blank">Savage Developers Guide: telnet</a> + * + * @author mcgredo + * @author brutzman@nps.edu + * @author james.timberlake@nps.edu */ public class Client { + + /** + * Default constructor + * Program invocation, execution starts here + * @param args command-line arguments + */ public static void main(String[] args) { DatagramSocket socket = null; Scanner scanner = new Scanner(System.in); diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework1/Timberlake/Server.java b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Timberlake/Server.java index 54b88a994bcad4a4313adad0f55ce44cd0910a05..c9cae31dc13da3679282630cfedccecff7a43af5 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework1/Timberlake/Server.java +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Timberlake/Server.java @@ -5,10 +5,56 @@ import java.net.DatagramSocket; import java.net.InetAddress; /** - * - * @author Jack + * <p> + * The simplest TCP network program, opening a socket between a client and server + * and send a message from the client to the server. + * It listens for any socket connection response, either from telnet (telnet localhost 2317) + * or another client program. + * Once a socket connection is established, the client sends messages to the + * server and the server echos the message back to the client. + * + * <p> + * As an alternative to running the Windows (or other operating system) console, + * you can instead run the NetBeans terminal window. If you are on Windows, + * NetBeans is looking for Cygwin installation (for Unix-like compatibility) + * with details at <a href="https://savage.nps.edu/Savage/developers.html#Cygwin" target="blank">Savage Developers Guide: Cygwin</a>. + * Modifying this program is the basis for Assignment 1. + * </p> + + * <p> + * Notice that "Client Received" matches + * what is written by the code below, over the output stream. + * </p> + * * <p> + * Notice that "Server Received" matches the string sent by the client. + * </p> + * <p> + * After the echoed message is received by the client, the program exits. + * For example: + * Enter message to send to server: hello + * Client received: Hello From Server, I received: hello + * [Program Exits] + * </p> + * + * @see <a href="../../../src/TcpExamples/TcpExample1TerminalLog.txt" target="_blank">TcpExample1TerminalLog.txt</a> + * @see <a href="../../../src/TcpExamples/TcpExample1NetBeansConsoleTelnet.png" target="_blank">TcpExample1NetBeansConsoleTelnet.png</a> + * @see <a href="../../../src/TcpExamples/TcpExample1NetBeansConsoleTelnet.pdf" target="_blank">TcpExample1NetBeansConsoleTelnet.pdf</a> + * @see <a href="../../../src/TcpExamples/TcpExample1ScreenshotNetcat.png" target="_blank">TcpExample1ScreenshotNetcat.png</a> + * @see <a href="../../../src/TcpExamples/TcpExample1ScreenshotTelnet.png" target="_blank">TcpExample1ScreenshotTelnet.png</a> + * @see <a href="https://savage.nps.edu/Savage/developers.html#Cygwin" target="blank">Savage Developers Guide: Cygwin</a> + * @see <a href="https://savage.nps.edu/Savage/developers.html#telnet" target="blank">Savage Developers Guide: telnet</a> + * + * @author mcgredo + * @author brutzman@nps.edu + * @author james.timberlake@nps.edu */ public class Server { + + /** + * Default constructor + * Program invocation, execution starts here + * @param args none + */ public static void main(String[] args) { DatagramSocket socket = null; diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework1/Timberlake/package-info.java b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Timberlake/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..a1c491cc4204d6fa3bf308982d9d26fbdc1b7948 --- /dev/null +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Timberlake/package-info.java @@ -0,0 +1,10 @@ +/** + * TCP Unicast homework assignments supporting the NPS MOVES MV3500 Networked Graphics course. + * + * @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/assignments" target="_blank">networkedGraphicsMV3500 assignments</a> + * @see java.lang.Package + * @see <a href="https://stackoverflow.com/questions/22095487/why-is-package-info-java-useful" target="_blank">StackOverflow: why-is-package-info-java-useful</a> + * @see <a href="https://stackoverflow.com/questions/624422/how-do-i-document-packages-in-java" target="_blank">StackOverflow: how-do-i-document-packages-in-java</a> + */ + +package MV3500Cohort2024JulySeptember.homework1.Timberlake; diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework1/Williams/package-info.java b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Williams/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..e068b5a40ffeab8cff6db5f24acd25b2fd19fa35 --- /dev/null +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework1/Williams/package-info.java @@ -0,0 +1,10 @@ +/** + * TCP Unicast homework assignments supporting the NPS MOVES MV3500 Networked Graphics course. + * + * @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/assignments" target="_blank">networkedGraphicsMV3500 assignments</a> + * @see java.lang.Package + * @see <a href="https://stackoverflow.com/questions/22095487/why-is-package-info-java-useful" target="_blank">StackOverflow: why-is-package-info-java-useful</a> + * @see <a href="https://stackoverflow.com/questions/624422/how-do-i-document-packages-in-java" target="_blank">StackOverflow: how-do-i-document-packages-in-java</a> + */ + +package MV3500Cohort2024JulySeptember.homework1.Williams; diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Bavlsik/BavlsikClient.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Bavlsik/BavlsikClient.java index 94fdb5e9a4f38266a166be160b3ac3a896fe3143..3879e0d2cc5be948a0f1e07b62fd9ce60e78952e 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Bavlsik/BavlsikClient.java +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Bavlsik/BavlsikClient.java @@ -8,11 +8,16 @@ import java.net.Socket; import java.util.Scanner; /** - * + * This client attempts to connect to a desired server. If the client is unable + * to connect then it exits the program. Enter 'quit' to the command line at any + * time to exit. * @author tbavlsik */ public class BavlsikClient { + /** + * Localhost address. + */ public final static String LOCALHOST = "0:0:0:0:0:0:0:1"; //Local host /** diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Lennon/LennonHW2Client.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Lennon/LennonHW2Client.java index 110b07a34a6b10224abfb7e64bbb038d082f6984..19849b95282785747b0ba46ee4005f3063be5a35 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Lennon/LennonHW2Client.java +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Lennon/LennonHW2Client.java @@ -11,7 +11,7 @@ import java.util.Scanner; /** * This client program establishes a socket connection to the {@link LennonHW2DispatchServer}, * then plays a random number guessing game. - * No fancy footwork here, it is pretty simple and similar to {@link TcpExample3Client}. + * No fancy footwork here, it is pretty simple and similar to {TcpExample3Client}. * * see TcpExample4DispatchServer * see TcpExample4HandlerThread diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Lennon/LennonHW2HandlerThread.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Lennon/LennonHW2HandlerThread.java index cce06e30b1f2cc41f8dd846f602ee6c9d0c8a0ad..ae2efde18bf5ffa7dc74ad60c8a5be9a994a8e51 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Lennon/LennonHW2HandlerThread.java +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Lennon/LennonHW2HandlerThread.java @@ -15,7 +15,7 @@ import java.util.Random; * if the server can't respond to a connection for several seconds. * </p> * <p> - * Warning: do not run this class! It is created and used automatically by {@link TcpExample4DispatchServer} at run time. + * Warning: do not run this class! It is created and used automatically by {@link LennonHW2DispatchServer} at run time. * </p> * * see TcpExample4Client diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Matiski/README.md b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Matiski/README.md index 40f59733d30e960b1d2b86877bd56751017c9911..aad80ff3ef5f483a30fd1c80c4ceda3bea519f11 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Matiski/README.md +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Matiski/README.md @@ -8,4 +8,6 @@ Modification to TCPExample4 to ask for a password Closes once password is entered correctly or incorrectly. +Biggest changes are in the handler thread. + diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Matiski/package-info.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Matiski/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..df351196c4dbbf4a620a3f9e9f6d3cf88626aff2 --- /dev/null +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Matiski/package-info.java @@ -0,0 +1,10 @@ +/** + * TCP Unicast homework assignments supporting the NPS MOVES MV3500 Networked Graphics course. + * + * @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/assignments" target="_blank">networkedGraphicsMV3500 assignments</a> + * @see java.lang.Package + * @see <a href="https://stackoverflow.com/questions/22095487/why-is-package-info-java-useful" target="_blank">StackOverflow: why-is-package-info-java-useful</a> + * @see <a href="https://stackoverflow.com/questions/624422/how-do-i-document-packages-in-java" target="_blank">StackOverflow: how-do-i-document-packages-in-java</a> + */ + +package MV3500Cohort2024JulySeptember.homework2.Matiski; diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/Client.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/Client.java index e96f8f8cb3fc9bda70dbd7b9658380b37729d98e..6d00c7b9512ffca329d5af2b9185c1fd9f2fd354 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/Client.java +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/Client.java @@ -1,16 +1,35 @@ package MV3500Cohort2024JulySeptember.homework2.Smith; +/** + * This the the rock paper sciccors client. + * @author tjsus + */ import java.io.*; import java.net.*; import java.util.Scanner; +/** + * Client Class + * @author tjsus + */ + public class Client { + /** + * Client constructor + */ public Client() { // default constructor } + /** + * local host + */ public final static String LOCALHOST = "0:0:0:0:0:0:0:1"; + /** + * Main + * @param args passed in args + */ public static void main(String[] args) { Socket socket = null; InputStream is; diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/README.md b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ea7585b7e94c797c6dae0e9e4c59dc50b0d6b727 --- /dev/null +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/README.md @@ -0,0 +1,10 @@ +# Smith Homework 2 + +*** + +## Description +Modification of TcpExample3 and adding some code to implement a rock, paper, sciccors game with a client. + +The 'Server' class sets up a server that listens for incoming client connections. + +The 'Client' class connects to a server running on localhost. It sends user input from the console to the server and displays messages received from the server. \ No newline at end of file diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/Server.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/Server.java index 09a08b2a969b78b6816ad430378de98872d09004..e76dd29e8176b156c16a8cf932c84174e1be4689 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/Server.java +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/Server.java @@ -1,16 +1,33 @@ package MV3500Cohort2024JulySeptember.homework2.Smith; +/** + * This the the rock paper sciccors server. + * @author tjsus + */ + import java.io.*; import java.net.*; import java.util.Random; +/** + * Client Class + * @author tjsus + */ + public class Server { private static int runningTotal = 0; // Initialize running total - + + /** + * Server constructor + */ public Server() { // default constructor } + /** + * Main + * @param args passed in args + */ public static void main(String[] args) { try { System.out.println(Server.class.getName() + " has started..."); diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/package-info.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..194b250d511cd953662daf6870f44b969e443cb3 --- /dev/null +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Smith/package-info.java @@ -0,0 +1,10 @@ +/** + * TCP Unicast homework assignments supporting the NPS MOVES MV3500 Networked Graphics course. + * + * @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/assignments" target="_blank">networkedGraphicsMV3500 assignments</a> + * @see java.lang.Package + * @see <a href="https://stackoverflow.com/questions/22095487/why-is-package-info-java-useful" target="_blank">StackOverflow: why-is-package-info-java-useful</a> + * @see <a href="https://stackoverflow.com/questions/624422/how-do-i-document-packages-in-java" target="_blank">StackOverflow: how-do-i-document-packages-in-java</a> + */ + +package MV3500Cohort2024JulySeptember.homework2.Smith; diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/Client_HW2.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/Client_HW2.java index 806d4bee9ad3e4f909819bf3d1a87053f755be23..aab58250d6a1f91ff76375126ab287212cd5c38a 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/Client_HW2.java +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/Client_HW2.java @@ -8,8 +8,21 @@ import java.util.Scanner; import java.io.PrintWriter; /** + * This client program establishes a socket connection to the {@link GameHandler.java}, + * then plays a random number guessing game. + * No fancy footwork here, it is pretty simple and similar to {@link TcpExample3Client}. + * + * see TcpExample4DispatchServer + * see TcpExample4HandlerThread * - * @author Jack + * @see <a href="../../../src/TcpExamples/TcpExample4TerminalLog.txt" target="blank">TcpExample4TerminalLog.txt</a> + * @see <a href="../../../src/TcpExamples/TcpExample4SequenceDiagram.png" target="blank">TcpExample4SequenceDiagram.png</a> + * @see <a href="../../../src/TcpExamples/TcpExample4SequenceSketch.png" target="blank">TcpExample4SequenceSketch.png</a> + * + * @author Don McGregor + * @author Don Brutzman + * @author MV3500 class + * @author Jack Timberlake */ diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/GameHandler.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/GameHandler.java index 9403aa23e5602254321633278d8e3ceb1a6dca8f..403a68b58b2ee0e0a528d3e63b40d96b6b2e2aed 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/GameHandler.java +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/GameHandler.java @@ -1,8 +1,28 @@ package MV3500Cohort2024JulySeptember.homework2.Timberlake; /** + * <p> + * This utility class supports the {@link Server_HW2} program, + * handling all programming logic needed for a new socket connection + * to run in a thread of its own. This is the server + * portion as well, so we artificially invent what happens + * if the server can't respond to a connection for several seconds. + * </p> + * <p> + * Warning: do not run this class! It is created and used automatically by {@link Server_HW2} at run time. + * </p> + * + * see Server_HW2 + * see Client_HW2 * - * @author Jack + * @see <a href="../../../src/TcpExamples/TcpExample4TerminalLog.txt" target="blank">TcpExample4TerminalLog.txt</a> + * @see <a href="../../../src/TcpExamples/TcpExample4SequenceDiagram.png" target="blank">TcpExample4SequenceDiagram.png</a> + * @see <a href="../../../src/TcpExamples/TcpExample4SequenceSketch.png" target="blank">TcpExample4SequenceSketch.png</a> + * + * @author Don McGregor + * @author Don Brutzman + * @author MV3500 class + * @author Jack Timberlake */ import java.io.BufferedReader; @@ -14,6 +34,12 @@ import java.util.HashMap; import java.util.Map; public class GameHandler implements Runnable { + /** + * The thread constructor creates the socket from a ServerSocket, waiting for the client to connect, + * and passes that socket when constructing the thread responsible for handling the connection. + * + * @param socket The socket connection handled by this thread + */ private Socket clientSocket; private int numToGuess; private static final Map<String, String> userCredentials = new HashMap<>(); diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/Server_HW2.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/Server_HW2.java index 987e79ec35af26cddb82cc8c5b53a889101993a3..36ed7fa156d1c6f7b6fbc568214f51ce66937633 100644 --- a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/Server_HW2.java +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/Server_HW2.java @@ -4,8 +4,21 @@ import java.net.ServerSocket; import java.net.Socket; /** + * This server program works a bit differently by creating and dispatching a + * new thread to handle multiple incoming socket connections, one after another, all running in parallel. + * This advanced technique is often used in high=performance high=capacity server programs. + * + * @see Client_HW2 + * @see GameHandler * - * @author Jack + * @see <a href="../../../src/TcpExamples/TcpExample4TerminalLog.txt" target="blank">TcpExample4TerminalLog.txt</a> + * @see <a href="../../../src/TcpExamples/TcpExample4SequenceDiagram.png" target="blank">TcpExample4SequenceDiagram.png</a> + * @see <a href="../../../src/TcpExamples/TcpExample4SequenceSketch.png" target="blank">TcpExample4SequenceSketch.png</a> + * + * @author Don McGregor + * @author Don Brutzman + * @author MV3500 class + * @author Jack Timberlake */ diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/package-info.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..9e861b1b2b6a22c7bfbdbd23a9f76b1f52deb7d9 --- /dev/null +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/package-info.java @@ -0,0 +1,10 @@ +/** + * TCP Unicast homework assignments supporting the NPS MOVES MV3500 Networked Graphics course. + * + * @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/assignments" target="_blank">networkedGraphicsMV3500 assignments</a> + * @see java.lang.Package + * @see <a href="https://stackoverflow.com/questions/22095487/why-is-package-info-java-useful" target="_blank">StackOverflow: why-is-package-info-java-useful</a> + * @see <a href="https://stackoverflow.com/questions/624422/how-do-i-document-packages-in-java" target="_blank">StackOverflow: how-do-i-document-packages-in-java</a> + */ + +package MV3500Cohort2024JulySeptember.homework2.Timberlake; diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Williams/package-info.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Williams/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..210b061bfb6cd4e538ee41584cdf6dfb31c25ad0 --- /dev/null +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Williams/package-info.java @@ -0,0 +1,10 @@ +/** + * TCP Unicast homework assignments supporting the NPS MOVES MV3500 Networked Graphics course. + * + * @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/assignments" target="_blank">networkedGraphicsMV3500 assignments</a> + * @see java.lang.Package + * @see <a href="https://stackoverflow.com/questions/22095487/why-is-package-info-java-useful" target="_blank">StackOverflow: why-is-package-info-java-useful</a> + * @see <a href="https://stackoverflow.com/questions/624422/how-do-i-document-packages-in-java" target="_blank">StackOverflow: how-do-i-document-packages-in-java</a> + */ + +package MV3500Cohort2024JulySeptember.homework2.Williams; diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/package-info.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..d1dfec512f5eb7fa3a009b9d2760c50107bc1479 --- /dev/null +++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/package-info.java @@ -0,0 +1,10 @@ +/** + * TCP Unicast homework assignments supporting the NPS MOVES MV3500 Networked Graphics course. + * + * @see <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/tree/master/assignments" target="_blank">networkedGraphicsMV3500 assignments</a> + * @see java.lang.Package + * @see <a href="https://stackoverflow.com/questions/22095487/why-is-package-info-java-useful" target="_blank">StackOverflow: why-is-package-info-java-useful</a> + * @see <a href="https://stackoverflow.com/questions/624422/how-do-i-document-packages-in-java" target="_blank">StackOverflow: how-do-i-document-packages-in-java</a> + */ + +package MV3500Cohort2024JulySeptember.homework2.Yu; diff --git a/examples/nbproject/project.xml b/examples/nbproject/project.xml index bd4589c403c0307b9edb0d25126b2a5fe03ae4bf..d7c8e3fd3bc7ee7e746750956a36a82fa1034338 100644 --- a/examples/nbproject/project.xml +++ b/examples/nbproject/project.xml @@ -4,7 +4,6 @@ <configuration> <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> <name>Networked Graphics MV3500 examples</name> - <explicit-platform explicit-source-supported="true"/> <source-roots> <root id="src.dir"/> <root id="src.src.dir"/> diff --git a/examples/src/OpenDis7Examples/AllPduReceiver.java b/examples/src/OpenDis7Examples/AllPduReceiver.java index 424ab01244d066a36803ca2b3ae0e425b4eb07cf..437b51d4413435b2b725a341e2aea3c08e864047 100644 --- a/examples/src/OpenDis7Examples/AllPduReceiver.java +++ b/examples/src/OpenDis7Examples/AllPduReceiver.java @@ -52,7 +52,7 @@ public class AllPduReceiver } else { - System.out.println("Usage: AllPduReceiver <multicast group> <port>"); + System.out.println("Usage: AllPduReceiver <multicast group address> <port>"); System.out.println("Default: AllPduReceiver " + DEFAULT_MULTICAST_ADDRESS + " " + DEFAULT_MULTICAST_PORT); multicastSocket = new MulticastSocket(DEFAULT_MULTICAST_PORT); multicastInetAddress = InetAddress.getByName(DEFAULT_MULTICAST_ADDRESS); diff --git a/examples/src/OpenDis7Examples/AllPduSender.java b/examples/src/OpenDis7Examples/AllPduSender.java index 441f9c1006c4c88eb6039de6f44e01a8e09b7594..57abbb763495462e7a8800c378f16af1be7cd9cb 100755 --- a/examples/src/OpenDis7Examples/AllPduSender.java +++ b/examples/src/OpenDis7Examples/AllPduSender.java @@ -541,13 +541,13 @@ public class AllPduSender if (args.length == 2) { - System.out.println("Usage: AllPduSender <multicast group> <port>"); + System.out.println("Usage: AllPduSender <multicast group address> <port>"); System.out.println("Actual: AllPduSender " + multicastInetAddress.getHostAddress() + " " + port); allPduSender = new AllPduSender(args[0], Integer.parseInt(args[1])); } else { - System.out.println("Usage: AllPduSender <multicast group> <port>"); + System.out.println("Usage: AllPduSender <multicast group address> <port>"); System.out.println("Default: AllPduSender " + DEFAULT_MULTICAST_ADDRESS + " " + DEFAULT_MULTICAST_PORT); allPduSender = new AllPduSender(DEFAULT_MULTICAST_ADDRESS, DEFAULT_MULTICAST_PORT); } diff --git a/examples/src/TcpExamples/TcpExample4SequenceDiagram.vsdx b/examples/src/TcpExamples/TcpExample4SequenceDiagram.vsdx index 92a2f421ccf30be47ba4ea902d375970c622701c..f05c6c6fbbf95ff23e9aa6f21ac753f1fdc300ee 100644 Binary files a/examples/src/TcpExamples/TcpExample4SequenceDiagram.vsdx and b/examples/src/TcpExamples/TcpExample4SequenceDiagram.vsdx differ diff --git a/presentations/07_NetworkScalability.pptx b/presentations/07_NetworkScalability.pptx index 24aa842b5144d027360522f81c4cef8d9a481544..5630756ba1ac73f4d1ca7df2dd32767878f27f2c 100644 Binary files a/presentations/07_NetworkScalability.pptx and b/presentations/07_NetworkScalability.pptx differ diff --git a/presentations/08_DIS_DistributedInteractiveSimulationProtocol.pptx b/presentations/08_DIS_DistributedInteractiveSimulationProtocol.pptx index 92c430624b119e692489eb8387a6eaefa2367b5a..50b349b842a15828b159444d1d348f4d273ff1c5 100644 Binary files a/presentations/08_DIS_DistributedInteractiveSimulationProtocol.pptx and b/presentations/08_DIS_DistributedInteractiveSimulationProtocol.pptx differ