Got an error message of "'.', hexadecimal value 0x00, is an invalid character"
<p>My code converts a String to bytes before sending: </p>

<pre><code>byte[] requestByte = Encoding.UTF8.GetBytes(requestString);
</code></pre>

<p>XML is sent as bytes over socket: </p>

<pre><code>int sentbytes = clientDAP.Send(requestByte, SocketFlags.None);
</code></pre>

<p>A response is retrieved afterwards from the host:</p>

<pre><code>byteResult = clientDAP.Receive(responseByte, SocketFlags.None);
</code></pre>

<p>I'm trying to get it to give me a String output from the bytes:</p>

<pre><code>responseString = Encoding.UTF8.GetString(responseByte);
</code></pre>

<p>Further, I'm trying to load the response string as XML:</p>

<pre><code>XmlDocument resultDoc = new XmlDocument();
resultDoc.LoadXml(responseString);
</code></pre>

<p>This gives me the following error: </p>

<blockquote>
  <p><strong><em>'.', hexadecimal value 0x00, is an invalid character. Line 2, position 1.</em></strong></p>
</blockquote>

<p>The <code>responseString</code> is as follows:</p>

<pre><code>&lt;Response User="abc" Type="123" Timestamp="02/04/2016 05:12:25:504 AM" Subtype="TRADE" 
  Name="css" Logging="Yes" Echo="No" Client="abc123" Caching="Yes"&gt;
  &lt;Output&gt;
    &lt;Reference&gt;23324&lt;/Reference&gt;
    &lt;Client&gt;GF23X&lt;/Client&gt;
    &lt;Source&gt;2324ffd&lt;/Source&gt;
    &lt;Region&gt;th&lt;/Region&gt;
    &lt;Status&gt;ok&lt;/Status&gt;
    &lt;Message&gt;Overall abc&lt;/Message&gt;&lt;Message&gt;Odef&lt;/Message&gt;
  &lt;/Output&gt;
&lt;/Response&gt;
</code></pre>

<p><strong>Update:</strong> I have seen all the suggestions in comments and tried with different encoding and decoding but nothing worked.</p>

<p>Your help is appreciated.</p>