title: Android-Client crashes while connecting to Java-Server
body: <p>i have watched a tutorial, and with the code of this, my phone phone chrashes every time it trys to send the text.</p>
  
  <p>Client:</p>
  
  <pre><code>    textField = (EditText) findViewById(R.id.editText1);
      button = (Button) findViewById(R.id.button1);   
  
      button.setOnClickListener(new View.OnClickListener() {
  
      public void onClick(View v) {
  
          messsage = textField.getText().toString(); 
          textField.setText("");   
  
          try {
  
           client = new Socket(InetAddress.getByName("jarves-server.no-ip.info"), 8000);  
           printwriter = new PrintWriter(client.getOutputStream(),true);
           printwriter.write(messsage);  
  
           printwriter.flush();
           printwriter.close();
           client.close();   
  
          } catch (UnknownHostException e) {
           e.printStackTrace();
          } catch (IOException e) {
           e.printStackTrace();
          }
         }
        });
  </code></pre>
  
  <p>Server:</p>
  
  <pre><code>public static void main(String[] args) {
      try {
          serverSocket = new ServerSocket(8000);
  
      } catch (IOException e) {
          System.out.println("Could not listen on port");
      }
  
      System.out.println("Server started.");
  
      while (true) {
          try {
  
              clientSocket = serverSocket.accept();   
              inputStreamReader = new InputStreamReader(clientSocket.getInputStream());
              bufferedReader = new BufferedReader(inputStreamReader); 
              message = bufferedReader.readLine();
  
              System.out.println(message);
              inputStreamReader.close();
              clientSocket.close();
  
          } catch (IOException ex) {
          }
      }
  }
  </code></pre>
  
  <p>I really don`t know what is wrong with the code. Maybe it could be also the DynDns i have set up with No-IP and our Speedport W723V and a Port forwarding on Port 8000 to my PC where the Server is running.</p>
  
  <p>Hope for help!</p>