diff --git a/assignments/src/MV3500Cohort2023MarchJune/homework1/Hedgcorth/Assignment1Client.java b/assignments/src/MV3500Cohort2023MarchJune/homework1/Hedgcorth/Assignment1Client.java index 081181e82a80c2ea29721ac3a323d624963ec595..6747eddc5525317b5f2df14df4de61d3685cd57c 100644 --- a/assignments/src/MV3500Cohort2023MarchJune/homework1/Hedgcorth/Assignment1Client.java +++ b/assignments/src/MV3500Cohort2023MarchJune/homework1/Hedgcorth/Assignment1Client.java @@ -71,7 +71,7 @@ public class Assignment1Client System.out.println("=================================================="); System.out.print ("Client loop " + clientLoopCount + ": "); - System.out.println("we are live!"); + System.out.println("we are live for 20...!"); System.out.println("The message the server sent was: '" + serverMessage + "'"); // socket gets closed, either automatically/silently by this code (or possibly by the server) diff --git a/assignments/src/MV3500Cohort2023MarchJune/homework1/Hedgcorth/Assignment1Server.java b/assignments/src/MV3500Cohort2023MarchJune/homework1/Hedgcorth/Assignment1Server.java index 5ed00e5e4ab2320ecec8196e693ce12be407629b..0a622df91314f40bca91eba324df3aa8f0097296 100644 --- a/assignments/src/MV3500Cohort2023MarchJune/homework1/Hedgcorth/Assignment1Server.java +++ b/assignments/src/MV3500Cohort2023MarchJune/homework1/Hedgcorth/Assignment1Server.java @@ -55,21 +55,21 @@ public class Assignment1Server { PrintStream ps; InetAddress localAddress, remoteAddress; int localPort, remotePort; - int serverLoopCount = 0; + int serverLoopCount = 20; // Server is up and waiting (i.e. "blocked" or paused) // Loop, infinitely, waiting for client connections. // Stop the program somewhere else. - while (serverLoopCount < 20) { + while (serverLoopCount > 0) { // block until connected to a client try ( Socket clientConnectionSocket = serverSocket.accept()) { - serverLoopCount++; // increment at beginning of loop for reliability + 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("This is response " + serverLoopCount + " produced by the server."); // this gets sent back to client! + ps.println("Connection will end in: " + serverLoopCount + "..."); // 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). @@ -78,7 +78,7 @@ public class Assignment1Server { localPort = clientConnectionSocket.getLocalPort(); remotePort = clientConnectionSocket.getPort(); - System.out.print("Server loop " + serverLoopCount + ": "); + //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 ))