diff --git a/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankServer.java b/assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankServer.java index b2f46cafd2d52da30e4abe1abaaa9016e7081cf4..601dee98773668ad0825792b46761da94bf52af8 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