title: HttpListener prevent Timeout
body: <p>I Implemented a <code>HttpListener</code> to process <strong>SoapRequests</strong>. This works fine but I can't find a soloution for the problem, that some soap-requests take too much time, resulting in timeouts on client side.</p>
  
  <p>How do I let the requesting client know, that his request is not a timeout?</p>
  
  <p>I thought about sending "dummy"-information while the request gets processsed, but the HttpListener only seems to send the data when you <code>Close</code> the response-object, and this can be done only once, so this is not the right thing to do I suppose.</p>
  
  <p>Soloution:</p>
  
  <pre><code>Thread alliveWorker = new Thread(() =&gt;
  {
      try
      {
          while (context.Response.OutputStream.CanWrite)
          {
              context.Response.OutputStream.WriteByte((byte) ' ');
              context.Response.OutputStream.Flush();
              Thread.Sleep(5000);
          }
      }
      finally
      {
  
      }
  });
  
  alliveWorker.Start();
  
  
  doWork();
  
  alliveWorker.Interrupt();
  
  createTheRealResponse();
  </code></pre>