title: Java Socket not sending message to the server
body: <p>I have the following client socket for sending a string to the server. The server is not getting message. What could be the prob;em?</p>
  
  <pre><code>public void startClient() throws IOException {
  
      Socket socket = null;
      PrintWriter out = null;
      BufferedReader in = null;
      InetAddress host = null;
      BufferedReader stdIn = null;
  
      try {
          host = InetAddress.getByName("172.16.2.97");
          socket = new Socket(host, 52000);
  
          out = new PrintWriter(socket.getOutputStream(), true);
          in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
  
          stdIn = new BufferedReader(new InputStreamReader(System.in));
          String fromServer;
          String fromUser = null;
          //ClientHelper.unpackISO();
          fromUser = ClientHelper.createISO();
          if (fromUser != null) {
              //System.out.println("Client - " + fromUser);
              out.write(fromUser);
              System.out.println("Sent message");
          }
  
  
          while ((fromServer = in.readLine()) != null) {
              System.out.println("Server - " + fromServer);
              if (fromUser != null) {
                  //System.out.println("Client - " + fromUser);
                  out.println(fromUser);
              }
          }
      } catch (ISOException ex) {
          Logger.getLogger(ClientDemo.class.getName()).log(Level.SEVERE, null, ex);
      } catch (UnknownHostException e) {
          System.err.println("Cannot find the host: " + host.getHostName());
          System.exit(1);
      } catch (IOException e) {
          System.err.println("Couldn't read/write from the connection: " +            e.getMessage());
          System.exit(1);
      } finally { //Make sure we always clean up
          out.close();
          in.close();
          stdIn.close();
          socket.close();
      }
  }
  </code></pre>
  
  <p>The method ClientHelper.createISO() return a string which is supposed to be sent to the server. Unfortunately the server is not getting any string. Could the problem be proxy settings. If so how can solve it. Or is it another problem with my code?
  What is the problem with my code?</p>