title: Determine when a stream is closed
body: <p>I'm trying to implement a network protocol class with an interface similar to <a href="http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx" rel="nofollow">WebRequest</a> specifically with the input stream returned by <a href="http://msdn.microsoft.com/en-us/library/system.net.webrequest.getrequeststream.aspx" rel="nofollow">GetRequestStream</a>, however I am having difficulty determining when the request stream is complete, as it does not have any events (disposing, etc).</p>
  
  <p>How can I monitor a Stream to determine when it is Closed/Disposed?  Is my only choice to wrap it in a class that implements <a href="http://msdn.microsoft.com/en-us/library/system.io.stream.aspx" rel="nofollow">Stream</a>?</p>
  
  <hr>
  
  <p>In particular I'm implementing FTP with some features that the FtpWebRequest does not (<code>SITE</code>, <code>ALLOC</code>, etc).  I need to know when the data stream is closed/complete so I can check the command stream for a success or error message.  </p>