From 8368d40cef74ee525f3cdf2e1cb9d29c379a86e3 Mon Sep 17 00:00:00 2001 From: justi <justi@LAPTOP-258UDA82> Date: Wed, 11 Aug 2021 17:21:11 -0700 Subject: [PATCH] Frank Assignment 2 --- .../homework2/Frank/FrankServer.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankServer.java b/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankServer.java index b2f46cafd2..601dee9877 100644 --- a/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankServer.java +++ b/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankServer.java @@ -28,6 +28,10 @@ public class FrankServer { InetAddress localAddress, remoteAddress; int localPort, remotePort; int serverLoopCount = 0; + InputStream is; + InputStreamReader isr; + BufferedReader br; + String clientMessage; // Server is up and waiting (i.e. "blocked" or paused) // Loop, infinitely, waiting for client connections. @@ -69,7 +73,11 @@ public class FrankServer { || remoteAddress.getHostName().equals(remoteAddress.getHostAddress())) { System.out.println(" note HostName matches address if host has no DNS name"); } - + is = clientConnectionSocket.getInputStream(); + isr = new InputStreamReader(is); + br = new BufferedReader(isr); + clientMessage = br.readLine(); + System.out.println("The message the client sent was: '" + clientMessage + "'");// Displaying the message the client sent // Not/*i*/ce 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 -- GitLab