title: Cannot read from TCP socket
body: <p>I have a C++ client using QT and a JAVA server and I have successfully written from the client to the server but I cannot write from the server to the client. My code:</p>
  
  <pre><code>QString
  Client::readTCP ( )
  {
      socketTCP-&gt;waitForReadyRead();
  
      QTextStream in (socketTCP);
  
      return in.readAll() ;
  }
  
  // Later on
  
  qDebug() &lt;&lt; Client::readTCP();
  </code></pre>
  
  <p>But no matter what method I choose I can't get a response from the server. The server code is as follows:</p>
  
  <pre><code>DataOutputStream  output = new DataOutputStream (SOCKET.getOutputStream());
  
  output.writeBytes ( "myString" );
  </code></pre>
  
  <p>ANSWER:</p>
  
  <p>It works either because I changed <code>in.readAll()</code> to <code>in.readLine()</code> or it is because I waited a couple seconds after the server started before sending a message.</p>