From 46da21c1ceb09b2d3447a4dd048b1579df7dddf4 Mon Sep 17 00:00:00 2001
From: "james.timberlake" <james.timberlake@nps.edu>
Date: Wed, 21 Aug 2024 10:50:25 -0700
Subject: [PATCH] HW2 javadoc

---
 .../homework2/Timberlake/Client_HW2.java      | 15 +++++++++-
 .../homework2/Timberlake/GameHandler.java     | 28 ++++++++++++++++++-
 .../homework2/Timberlake/Server_HW2.java      | 15 +++++++++-
 3 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/Client_HW2.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Timberlake/Client_HW2.java
index 806d4bee9a..aab58250d6 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 9403aa23e5..403a68b58b 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 987e79ec35..36ed7fa156 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
  */
 
 
-- 
GitLab