Commit ca0737d4 authored by 9731087's avatar 9731087

Second edition: firstEdition + server sends a message too, and Client catches.

parent 06ffa244
......@@ -19,6 +19,14 @@ public class ClientHandler implements Runnable {
//TODO: implement this method
// System.out.println("This is incoming message from Client: ");
System.out.println(message);
PrintWriter printWriter = null;
try {
printWriter = new PrintWriter(new OutputStreamWriter(client.getOutputStream()));
} catch (IOException e) {
e.printStackTrace();
}
printWriter.println(message);
printWriter.flush();
}
@Override
......
......@@ -17,8 +17,9 @@ public class Network {
PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
printWriter.println("Hello from " + socket.getLocalSocketAddress());
printWriter.flush();
//socket.close();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
System.out.println(bufferedReader.readLine());
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment