title: Is it better to send 1 large chunk or lots of small ones when using TCP?
body: <p>After I <code>accept()</code> a connection, and then <code>write()</code> to the client socket, is it better to write all the data you intend to send at once or send it in chunks?</p>
  
  <p>For example:</p>
  
  <blockquote>
    <p>accept, write 1MB, disconnect</p>
  </blockquote>
  
  <p>…or…</p>
  
  <blockquote>
    <p>accept, write 256 bytes, write 256 bytes, … n, disconnect</p>
  </blockquote>
  
  <p>My gut feeling tells me that the underlying protocol does this automatically, with error correction, etc. Is this correct, or should I be chunking my data?</p>
  
  <p>Before you ask, no I'm not sure where I got the idea to chunk the data – I think it's an instinct I've picked up from programming C# web services (to get around receive buffer limits, etc, I think). Bad habit?</p>
  
  <p><em>Note</em>: I'm using C</p>