title: DataOutputStream not flushing
body: <p>I have a Java Client which sends UTF-8 strings to a C# TCP-Server, I'm using a DataOutputStream to send the strings. The code looks like this:</p>
  
  <pre><code>public void sendUTF8String(String ar) {
      if (socket.isConnected()) {
          try {
              dataOutputStream.write(ar.getBytes(Charset.forName("UTF-8")));
              dataOutputStream.flush();
          } catch (IOException e) {
              handleException(e);
          }
      }
  }
  </code></pre>
  
  <p>The problem is that flush doesn't seem to work right. If I send two Strings close to each other, the server receives only one message with both strings. The whole thing works if I do a Thread.sleep(1000) between calls, this is obviously not a solution.
  What am I missing?</p>