title: XML Delimiters over TCP/IP Socket
body: <p>Ok, so I have done a little searching and found the answer to my question about how to properly frame my incoming XML data over my TCP socket is to either send the XML with a header indicating size beforehand, or use delimiting escape sequences. Since I am basically writing a client for a very old C server which consequently communicates with a number of other clients which I'm not interested in having to tinker with I chose the latter. Previously I was actually stripping the '\n' out of the stream because I was ignorant to what its purpose was. Now when my asynchronous OnDataReceived method is called I do get a nice chunk of data with the d elimiters, here is a sample picked from the stream and stored in a string variable:</p>
  
  <pre><code>&lt;?xml version=\"1.0\"?&gt;&lt;message&gt;&lt;type&gt;SERVER&lt;/type&gt;&lt;user&gt;TestDeleteOrKillMe&lt;/user&gt;                   &lt;cmd&gt;PRIVATE_MSG&lt;/cmd&gt;&lt;host&gt;65.255.81.81&lt;/host&gt;&lt;msg&gt;4111|3.16C (UNIX)|&lt;/msg&gt;&lt;/message&gt;\n&lt;?xml version=\"1.0\"?&gt;&lt;message&gt;&lt;type&gt;SERVER&lt;/type&gt;&lt;user&gt;TestDeleteOrKillMe&lt;/user&gt;    &lt;cmd&gt;PRIVATE_MSG&lt;/cmd&gt;&lt;host&gt;65.255.81.81&lt;/host&gt;&lt;msg&gt;4362|copyright 1993 by James D. Bennett|&lt;/msg&gt;&lt;/message&gt;\n
  </code></pre>
  
  <p>My question is now what is the procedure for pulling the string values out of the individual XML "statements?" so that I can send these to my ParseMessage(string) method and start processing them? At first I was thinking of possibly some RegEx to maybe start at the beginning until it finds the first \n and then select and strip all of the previous text out? I'd like to hear some input on what the common(or uncommon) practices for this problem is before I begin some possibly overly convoluted approach. Much thanks.</p>