title: Network communication isn´t working
body: <p>I made a little game. Now i want to get the highscore from my Server. The code on the client:</p>
  
  <pre><code>        private int getOnlineHighscore() {
      int highscore = 0;
      try {
          socket = new Socket("localhost", 444);
          input = socket.getInputStream();
          System.out.println(input);
          highscore = input.read();
          input.close();
          socket.close();
          input = null;
          socket = null;
      } catch (Exception e) {
          System.out.println("Verbindung fehlgeschlagen!");
      }
      System.out.println(highscore);
      return highscore;
  }
  </code></pre>
  
  <p>And on the Server:</p>
  
  <pre><code>import java.io.*;
  import java.net.*;
  
   public class ReadServer extends Thread {
   private Socket socket;
  
  public ReadServer(Socket socket) {
      super();
      this.socket = socket;
  }
  
  public void run() {
      try {
          System.out.println(socket.getInetAddress());
          String result = "";
          try (BufferedReader br = new BufferedReader(
                  new FileReader(System.getProperty("user.home") + "/AppData/Roaming/GameServer/.sg"))) {
              StringBuilder sb = new StringBuilder();
              String line = br.readLine();
              System.out.println("2");
              while (line != null) {
                  sb.append(line);
                  sb.append(System.lineSeparator());
                  line = br.readLine();
              }
              System.out.println("3");
              result = sb.toString();
              System.out.println("3.5");
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
          System.out.println("4");
          socket.getOutputStream().write(Integer.parseInt(result));
          System.out.println(result);
      } catch (Exception e) {
      }
  
      try {
          socket.close();
      } catch (Exception e) {
      }
  }
  
  public static void main(String[] Args) {
      Socket socket = null;
      ServerSocket server = null;
      try {
          server = new ServerSocket(444);
          while (true) {
              socket = server.accept();
              new ReadServer(socket).start();
          }
      } catch (Exception e) {
      }
  
      try {
          server.close();
      } catch (Exception e) {
      }
  }
  }
  </code></pre>
  
  <p>If I run it, the client function returns:
      -1
  The server writes in the console(not important I think):
      /127.0.0.1
      2
      3
      3.5
      4</p>
  
  <p>How to solve the problem? I want to send an int stored on my Server to a client.</p>
  
  <p>-Jakob</p>