title: Deserializing .NET stream with multiple objects
body: <p>I have a MemoryStream which I write into as I receive data off the network. Since the data can be broken up, there is the potential for the stream to have a partial message or multiple messages stored in the stream. When deserializing, I place the pointer back at the beginning of the stream and try to deserialize a class of mine. I have the deserialize wrapped in a try catch block, but I get to the deserialize line, the application just quits out (no exception, not more lines run in the function, etc).</p>
  
  <p>I have multiple questions:</p>
  
  <ol>
  <li>What is the best way to receive a stream of XML data from the network that may or may not be complete, and if so may or may not have more than one message?</li>
  <li>Does the deserializer need to know about the encoding to decode the XML within the MemoryStream?</li>
  <li>Does deserialization place the stream pointer after the deserialized object?</li>
  <li>Can you deserialize multiple objects within a single stream?</li>
  </ol>