diff --git a/projects/TcpExample3/Client/TcpClient/src/tcpclient/TcpClient.java b/projects/TcpExample3/Client/TcpClient/src/tcpclient/TcpClient.java index 2e804a4408ec3205eaf30243e7a83be80734e41d..ff2dbb3d9b7714fe12daf1d0cf1e30758851bbba 100644 --- a/projects/TcpExample3/Client/TcpClient/src/tcpclient/TcpClient.java +++ b/projects/TcpExample3/Client/TcpClient/src/tcpclient/TcpClient.java @@ -20,7 +20,7 @@ public class TcpClient { public static void main(String[] args) { try { while (true) { - System.out.println("creating socket"); + System.out.println("TcpClient creating socket..."); // We request an IP to connect to ("localhost") and // port number at that IP (2317). This establishes @@ -29,13 +29,14 @@ public class TcpClient { // connections. Socket socket = new Socket(LOCALHOST, 2317); // locohost? + // Now hook everything up (i.e. set up the streams), Java style: + InputStream is = socket.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + // Read the single line written by the server. We'd // do things a bit differently if many lines to be read // from the server, instead of one only. - InputStream is = socket.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - BufferedReader br = new BufferedReader(isr); - String serverMessage = br.readLine(); System.out.println("=================================================="); System.out.println("Now we're talking!");