title: Use MemoryStream (or other) as circular buffer for TCP communication
body: <p>I am in the process of simplifying/optimizing some code I wrote a while ago. I had created a custom circular buffer class that served it's purpose but I am hoping to replace it with something more standard for any consuming code.</p>
  
  <p>The requirements are (and what my <code>CircularBuffer</code> aleady does):</p>
  
  <ol>
  <li>Ability to peek (read without permanently consuming) <em>more</em> than one byte. This is required because the network messages have a two byte length prefix and i'd rather not buffer a buffer.</li>
  <li>Starts writing from the beginning once it reaches it's maximum length (circular)</li>
  <li>Ability to throw an exception when it overflows (overwrites non-consumed data)</li>
  </ol>
  
  <p>What would also be nice is the ability to write and read at the same time, something I never got around to figuring out in my circular buffer.</p>
  
  <p>I have my eye on <code>MemoryStream</code> but from the documentation I can't determine if it satisfies #2 and #3. </p>
  
  <p>So, are there any streams that support/can support (with modification) my requirements, or am I stuck creating my own custom circular buffer?</p>