title: When should you discard the in and/or out buffers of a SerialPort?
body: <p>I am having small esoteric issues with my usage of the <code>System.IO.Ports.SerialPort</code> class in my C# application. I currently have written a thread safe class on top of the <code>SerialPort</code> class and am having issues with <code>Read</code>s and <code>Write</code>s that occur with short times in between. </p>
  
  <p>For instance I might <code>Write</code> a command and then <code>Read</code> a response. This behavior is within a <code>lock</code> statement, once the lock releases I might have a <code>Write</code> that occurs and then another <code>Write</code> <code>Read</code>. On my second <code>Read</code> I sometimes receive an empty <code>String</code>. </p>
  
  <p>Now that is just to outline my issue, but trying to make a question that is answerable. I am simply looking for information about when you should use <code>DiscardOutBuffer</code> and <code>DiscardInBuffer</code>? <strong>Basically are there any conventions on when to use these functions? Also, are the buffers ever discarded automatically in the underlying <code>SerialPort</code> implementation?</strong></p>
  
  <p>I have to assume that my issues lie with the buffers. That either the in buffer is discard too early or that in buffer is not cleared in time.</p>