title: Reading From a TCP Socket
body: <p>I have clients sending a request of a very simple form: just the string <code>GET/PUT/INSERT/DELETE KEY &lt;VALUE&gt;</code> where value is optional depending on the selected keyword.</p>
  
  <p>Keys and values can be arbitrarily sized.</p>
  
  <p>I am implementing a server in C to service the requests however I think I am running into the issue that the read() system call reads some, but not all data.  That is, what the server read is only a subset of what the client sent.</p>
  
  <p>How can I know when the entire message has been read?</p>
  
  <p>Example Requests:
  <code>INSERT KEYkeyKEYkeyKEY VALUEvalueVALUEvalueVALUE</code></p>
  
  <p>But the Server Might Read:
  <code>INSERT KEYkeyKEYkeyKEY VALUEvalueVALUE</code></p>
  
  <p>How can I know the entire message has not yet been received and read?</p>