title: Mjpeg VLC and HTTP Streaming
body: <p>I'm generating a MJpeg Stream and trying to stream it to VLC and play it there.</p>
  
  <p>The code:</p>
  
  <pre><code>        public void SendMultiPartData(String contentType, Func&lt;byte[]&gt; getData)
      {
          MemoryStream mem = null;
          response.StatusCode = 200;
          for ( byte[] buffer = getData(); buffer != null &amp;&amp; buffer.Length &gt; 0; buffer = getData())
          {
              response.ContentType = "multipart/x-mixed-replace; boundary=--testboundary";
              ASCIIEncoding ae = new ASCIIEncoding();
              byte[] boundary = ae.GetBytes("\r\n--testboundary\r\nContent-Type: " + contentType + "\r\nContent-Length:" + buffer.Length + "\r\n\r\n");
              mem = new MemoryStream(boundary);
              mem.WriteTo(response.OutputStream);
              mem = new MemoryStream(buffer);
              mem.WriteTo(response.OutputStream);
              response.OutputStream.Flush();
          }
          mem.Close();
          listener.Close();
      }
  </code></pre>
  
  <p>If I try to open the stream with firefox, there's no problem at all, although with VLC it doesn't work (VLC seems to keep reading but never shows the video)</p>
  
  <p>I've been sniffing VLC-to-VLC streaming and they seems to use as HTTP header "application/octet-stream" instead of multipart/x-mixed-replace</p>
  
  <p>Any ideas ?</p>
  
  <p>Tks in advance,
  Jose</p>