title: C++ TCP socket multiple write() on server side treated as single read on client side
body: <p>I'm developing a program with TCP connection, which consists of a server and multiple clients. </p>
  
  <p>Server side</p>
  
  <pre><code>write(sockFd,message,strlen(message));
  write(sockFd,message2,strlen(message2));
  </code></pre>
  
  <p>Client side</p>
  
  <pre><code>char msg[256];
  
  bzero(msg, 256);
  n = read (listenFd, msg, 255);
  cout &lt;&lt; "Msg1 " &lt;&lt; msg &lt;&lt; endl;
  
  bzero(msg, 256);
  n = read (listenFd, msg, 255);
  cout &lt;&lt; "Msg2 " &lt;&lt; msg &lt;&lt; endl;
  </code></pre>
  
  <p>The problem is  after the server write() the two messages, the first read() on the client(s) may read all of messages from server.
  For example, the output is Msg 1 content-of-msg1content-of-msg2. Why it can happen?</p>