From dd4dded93b46e42e7da4a6011eedb49ce71680ad Mon Sep 17 00:00:00 2001
From: advan <advan@JinHong.ern.nps.edu>
Date: Sun, 11 Aug 2024 01:08:54 -0700
Subject: [PATCH] Assignment 2

---
 .../homework2/Yu/YuHW2Client.java             | 21 ++--------------
 .../homework2/Yu/YuHW2HandlerThread.java      | 24 ++-----------------
 .../homework2/Yu/YuHW2Server.java             | 14 +++++------
 3 files changed, 11 insertions(+), 48 deletions(-)

diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/YuHW2Client.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/YuHW2Client.java
index e292bcb73d..ae3a4db744 100644
--- a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/YuHW2Client.java
+++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/YuHW2Client.java
@@ -1,28 +1,11 @@
-package TcpExamples;
+package MV3500Cohort2024JulySeptember.homework2.Yu;
 
 import java.io.*;
 import java.net.*;
 //import java.time.LocalTime; // conversion?
 
 /**
- * This client program establishes a socket connection to the
- * {@link TcpExample4DispatchServer}, then checks how long it takes to read the
- * single line it expects as a server response. No fancy footwork here, it is
- * pretty simple and similar to {@link TcpExample3Client}.
- *
- * @see TcpExample4DispatchServer
- * @see TcpExample4HandlerThread
- *
- * @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 Jin Hong Yu
  */
 public class YuHW2Client {
 
diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/YuHW2HandlerThread.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/YuHW2HandlerThread.java
index 606510f2d7..ac93fcfd4a 100644
--- a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/YuHW2HandlerThread.java
+++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/YuHW2HandlerThread.java
@@ -1,30 +1,10 @@
-package TcpExamples;
+package MV3500Cohort2024JulySeptember.homework2.Yu;
 
 import java.io.*;
 import java.net.*;
 
 /**
- * <p>
- * This utility class supports the {@link TcpExample4DispatchServer} 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 TcpExample4DispatchServer} at run time.
- * </p>
- * 
- * @see TcpExample4Client
- * @see TcpExample4DispatchServer
- *
- * @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 Jin Hong Yu
  */
 public class YuHW2HandlerThread extends Thread
 {
diff --git a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/YuHW2Server.java b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/YuHW2Server.java
index 9c2abe6e38..28d5a3d8a0 100644
--- a/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/YuHW2Server.java
+++ b/assignments/src/MV3500Cohort2024JulySeptember/homework2/Yu/YuHW2Server.java
@@ -1,4 +1,4 @@
-package TcpExamples;
+package MV3500Cohort2024JulySeptember.homework2.Yu;
 
 import java.io.IOException;
 import java.net.*;
@@ -22,11 +22,11 @@ public class YuHW2Server
         try {
             ServerSocket             serverSocket = new ServerSocket(2317);
             Socket                   clientConnectionSocket;
-            TcpExample4HandlerThread handlerThread;
+            YuHW2HandlerThread handlerThread;
 
             int connectionCount = 0; // state variable
 
-            System.out.println(TcpExample4DispatchServer.class.getName() + " ready to accept socket connections...");
+            //System.out.println(TcpExample4DispatchServer.class.getName() + " ready to accept socket connections...");
             while (true) // infinite loop
             {
                 clientConnectionSocket = serverSocket.accept(); // block! until connected
@@ -35,18 +35,18 @@ public class YuHW2Server
                 
                 
                 System.out.println("=============================================================");
-                System.out.println(TcpExample4DispatchServer.class.getName() + ".handlerThread created for connection #" + connectionCount + "...");
+                //System.out.println(TcpExample4DispatchServer.class.getName() + ".handlerThread created for connection #" + connectionCount + "...");
                 
                 // hand off this aready-created and connected socket to constructor
-                handlerThread = new TcpExample4HandlerThread(clientConnectionSocket); 
+                handlerThread = new YuHW2HandlerThread(clientConnectionSocket); 
                 handlerThread.start();// invokes the run() method in that object
-                System.out.println(TcpExample4DispatchServer.class.getName() + ".handlerThread is now dispatched and running, using most recent connection...");
+                //System.out.println(TcpExample4DispatchServer.class.getName() + ".handlerThread is now dispatched and running, using most recent connection...");
                 
                 // while(true) continue looping, serverSocket is still waiting for another customer client
             }
         } 
         catch (IOException e) {
-            System.out.println("Problem with " + TcpExample4DispatchServer.class.getName() + " networking:"); // describe what is happening
+            //System.out.println("Problem with " + TcpExample4DispatchServer.class.getName() + " networking:"); // describe what is happening
             System.out.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) {
-- 
GitLab