title: Is getting post data from HttpListenerRequest asynchronously possible?
body: <p>msdn give's us this example to retrieve the post data.</p>
  
  <pre><code> public static void ShowRequestData (HttpListenerRequest request)
   {
       if (!request.HasEntityBody)
       {
           Console.WriteLine("No client data was sent with the request.");
           return;
       }
       System.IO.Stream body = request.InputStream;
       System.Text.Encoding encoding = request.ContentEncoding;
       System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
       if (request.ContentType != null)
       {
           Console.WriteLine("Client data content type {0}", request.ContentType);
       }
       Console.WriteLine("Client data content length {0}", request.ContentLength64);
  
       Console.WriteLine("Start of client data:");
       // Convert the data to a string and display it on the console.
       string s = reader.ReadToEnd();
       Console.WriteLine(s);
       Console.WriteLine("End of client data:");
       body.Close();
       reader.Close();
       // If you are finished with the request, it should be closed also.
   }
  </code></pre>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/system.net.httplistenerrequest.inputstream.aspx" rel="nofollow noreferrer">source</a></p>
  
  <p>I checked the Streamreader class and there are no Begin... End... methods. Does this mean the Post data can not be retrieved asynchronously? Or has it already been retrieved before the callback from the HttpListener came?</p>
  
  <p>I would not like to get a thread-stall while a chunk of slow post data comes in.</p>
  
  <p>What is the correct asynchronous way to do this? (or is the ReadToEnd in fact correct?)</p>
  
  <p>thanks</p>
  
  <p>R </p>