Commit cb95a5ec authored by Trisha Gee's avatar Trisha Gee
Browse files

[Ch15] Chat client works. Something's not right with try-with-resources.

parent 3055cbc4
Loading
Loading
Loading
Loading
+3 −2
Changes for src/main/java/ch15/SimpleChatClient.java: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -46,8 +46,9 @@ public class SimpleChatClient {
  }

  private void setUpNetworking() {
    InetSocketAddress serverAddress = new InetSocketAddress("127.0.0.1", 5000);
    try (SocketChannel socketChannel = SocketChannel.open(serverAddress)) {
    try {
      SocketChannel socketChannel = SocketChannel.open(new InetSocketAddress("127.0.0.1", 5000));

      reader = new BufferedReader(Channels.newReader(socketChannel, StandardCharsets.UTF_8));
      writer = new PrintWriter(Channels.newWriter(socketChannel, StandardCharsets.UTF_8));