<div dir="ltr"><div><br></div>Hi,<div><br></div><div>I have tried to create a goloang http server (based on a node.js sample)  that receives a webm file through a tcp port in order to serve through http get the file to the browser.</div>
<div><br></div><div>The pipeline I use is</div><div><br></div><div>gst-launch-1.0 webmmux name=mux ! tcpclientsink port=3005  videotestsrc pattern=snow  num-buffers=250 ! video/x-raw,framerate=25/1 ! videoconvert ! vp8enc ! queue ! mux.video_0<br>
</div><div><br></div><div>the idea behind the golang application is that it listens on http port 9001 for path</div><div><br></div><div><a href="http://localhost:9001/stream.webm">http://localhost:9001/stream.webm</a></div>
<div><br></div><div>As soon s the browser connects, it sends the headers</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px">t<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span>time<span style="color:rgb(0,0,0)">.</span>Now<span style="color:rgb(0,0,0)">().</span>UTC<span style="color:rgb(0,0,0)">()</span></pre>
</div><div><pre style="margin-top:0px;margin-bottom:0px">w<span style="color:rgb(0,0,0)">.</span>Header<span style="color:rgb(0,0,0)">().</span>Set<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Date"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>t<span style="color:rgb(0,0,0)">.</span>Format<span style="color:rgb(0,0,0)">(</span>layoutee<span style="color:rgb(0,0,0)">))</span></pre>

<pre style="margin-top:0px;margin-bottom:0px">w<span style="color:rgb(0,0,0)">.</span>Header<span style="color:rgb(0,0,0)">().</span>Set<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Connection"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"Close"</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px">w<span style="color:rgb(0,0,0)">.</span>Header<span style="color:rgb(0,0,0)">().</span>Set<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Cache-Control"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"private"</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px">w<span style="color:rgb(0,0,0)">.</span>Header<span style="color:rgb(0,0,0)">().</span>Set<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Content-Type"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"video/webm"</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><br></pre></div><div>and begins to listen on port 3005</div><div><br></div><div>Then I start the pipeline and the server copies what it receives through port 3005 to the response body</div>
<div><br></div><div>But after some bytes and without showing anything, either chromium or firefox closes the connection.</div><div><br></div><div>I am on Windows 7 x86, gstreamer-1.0-x86-1.2.2, golang 1.2</div><div><br></div>
<div>Is the rationale sane?</div><div><br></div><div>I put the golang code in case someone wants to test</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="font-weight:600;color:rgb(0,0,128)">package</span><span style="color:rgb(192,192,192)"> </span>main</pre>

<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-weight:600;color:rgb(0,0,128)">import</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">"fmt"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">"html"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">"log"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">"net"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">"net/http"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">"net/http/httputil"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">"os"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">"time"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-weight:600;color:rgb(0,0,128)">const</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>RECV_BUF_LEN<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">1024</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>layoutee<span style="color:rgb(192,192,192)">     </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span>http<span style="color:rgb(0,0,0)">.</span>TimeFormat</pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-weight:600;color:rgb(0,0,128)">type</span><span style="color:rgb(192,192,192)"> </span>myHandler<span style="color:rgb(192,192,192)"> </span><span style="font-weight:600;color:rgb(0,0,128)">struct</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-weight:600;color:rgb(0,0,128)">func</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span>v<span style="color:rgb(192,192,192)"> </span>*myHandler<span style="color:rgb(0,0,0)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">ServeHTTP(</span>w<span style="color:rgb(192,192,192)"> </span>http<span style="color:rgb(0,0,0)">.</span>ResponseWriter<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>r<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">*</span>http<span style="color:rgb(0,0,0)">.</span>Request<span style="color:rgb(0,0,0)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>fmt<span style="color:rgb(0,0,0)">.</span>Println<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Hello</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">World!"</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>g1<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>_<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span>httputil<span style="color:rgb(0,0,0)">.</span>DumpRequest<span style="color:rgb(0,0,0)">(</span>r<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">true</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>fmt<span style="color:rgb(0,0,0)">.</span>Println<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,128)">string</span><span style="color:rgb(0,0,0)">(</span>g1<span style="color:rgb(0,0,0)">))</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>t<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span>time<span style="color:rgb(0,0,0)">.</span>Now<span style="color:rgb(0,0,0)">().</span>UTC<span style="color:rgb(0,0,0)">()</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>w<span style="color:rgb(0,0,0)">.</span>Header<span style="color:rgb(0,0,0)">().</span>Set<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Date"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>t<span style="color:rgb(0,0,0)">.</span>Format<span style="color:rgb(0,0,0)">(</span>layoutee<span style="color:rgb(0,0,0)">))</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>w<span style="color:rgb(0,0,0)">.</span>Header<span style="color:rgb(0,0,0)">().</span>Set<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Connection"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"Close"</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>w<span style="color:rgb(0,0,0)">.</span>Header<span style="color:rgb(0,0,0)">().</span>Set<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Cache-Control"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"private"</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>w<span style="color:rgb(0,0,0)">.</span>Header<span style="color:rgb(0,0,0)">().</span>Set<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Content-Type"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"video/webm"</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>w<span style="color:rgb(0,0,0)">.</span>Header<span style="color:rgb(0,0,0)">().</span>Set<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Server"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"CustomStreamer/0.0.1"</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>listener<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>err<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span>net<span style="color:rgb(0,0,0)">.</span>Listen<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"tcp"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"<a href="http://0.0.0.0:3005">0.0.0.0:3005</a>"</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="font-weight:600;color:rgb(0,0,128)">if</span><span style="color:rgb(192,192,192)"> </span>err<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">!=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">nil</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>fmt<span style="color:rgb(0,0,0)">.</span>Fprintf<span style="color:rgb(0,0,0)">(</span>w<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"error</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">listening:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,128)">%q</span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>html<span style="color:rgb(0,0,0)">.</span>EscapeString<span style="color:rgb(0,0,0)">(</span>err<span style="color:rgb(0,0,0)">.</span>Error<span style="color:rgb(0,0,0)">()))</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,128)">println</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"error</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">listening:"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>err<span style="color:rgb(0,0,0)">.</span>Error<span style="color:rgb(0,0,0)">())</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>w<span style="color:rgb(0,0,0)">.(</span>http<span style="color:rgb(0,0,0)">.</span>Flusher<span style="color:rgb(0,0,0)">).</span>Flush<span style="color:rgb(0,0,0)">()</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="font-weight:600;color:rgb(0,0,128)">return</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>conn<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>err<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span>listener<span style="color:rgb(0,0,0)">.</span>Accept<span style="color:rgb(0,0,0)">()</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="font-weight:600;color:rgb(0,0,128)">if</span><span style="color:rgb(192,192,192)"> </span>err<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">!=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">nil</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>fmt<span style="color:rgb(0,0,0)">.</span>Fprintf<span style="color:rgb(0,0,0)">(</span>w<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"Error</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">accept:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,128)">%q</span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>html<span style="color:rgb(0,0,0)">.</span>EscapeString<span style="color:rgb(0,0,0)">(</span>err<span style="color:rgb(0,0,0)">.</span>Error<span style="color:rgb(0,0,0)">()))</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,128)">println</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Error</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">accept:"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>err<span style="color:rgb(0,0,0)">.</span>Error<span style="color:rgb(0,0,0)">())</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>w<span style="color:rgb(0,0,0)">.(</span>http<span style="color:rgb(0,0,0)">.</span>Flusher<span style="color:rgb(0,0,0)">).</span>Flush<span style="color:rgb(0,0,0)">()</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="font-weight:600;color:rgb(0,0,128)">return</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>c<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">make</span><span style="color:rgb(0,0,0)">(</span><span style="font-weight:600;color:rgb(0,0,128)">chan</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">[]</span><span style="color:rgb(0,0,128)">byte</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>q<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">make</span><span style="color:rgb(0,0,0)">(</span><span style="font-weight:600;color:rgb(0,0,128)">chan</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">bool</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="font-weight:600;color:rgb(0,0,128)">go</span><span style="color:rgb(192,192,192)"> </span>gstreamerFunc<span style="color:rgb(0,0,0)">(</span>conn<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>c<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>q<span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="font-weight:600;color:rgb(0,0,128)">for</span><span style="color:rgb(192,192,192)"> </span>buf<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span><span style="font-weight:600;color:rgb(0,0,128)">range</span><span style="color:rgb(192,192,192)"> </span>c<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>writelen<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">len</span><span style="color:rgb(0,0,0)">(</span>buf<span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,128)">println</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"got</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>writelen<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">bytes</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">of</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">data</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">="</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>_<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>err2<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span>w<span style="color:rgb(0,0,0)">.</span>Write<span style="color:rgb(0,0,0)">(</span>buf<span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="font-weight:600;color:rgb(0,0,128)">if</span><span style="color:rgb(192,192,192)"> </span>err2<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">!=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">nil</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,0,128)">println</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Error</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">2</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">writing</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">data:"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>err2<span style="color:rgb(0,0,0)">.</span>Error<span style="color:rgb(0,0,0)">())</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,0,128)">close</span><span style="color:rgb(0,0,0)">(</span>q<span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>listener<span style="color:rgb(0,0,0)">.</span>Close<span style="color:rgb(0,0,0)">()</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="font-weight:600;color:rgb(0,0,128)">return</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>w<span style="color:rgb(0,0,0)">.(</span>http<span style="color:rgb(0,0,0)">.</span>Flusher<span style="color:rgb(0,0,0)">).</span>Flush<span style="color:rgb(0,0,0)">()</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,128)">close</span><span style="color:rgb(0,0,0)">(</span>q<span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>listener<span style="color:rgb(0,0,0)">.</span>Close<span style="color:rgb(0,0,0)">()</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>w<span style="color:rgb(0,0,0)">.(</span>http<span style="color:rgb(0,0,0)">.</span>Flusher<span style="color:rgb(0,0,0)">).</span>Flush<span style="color:rgb(0,0,0)">()</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-weight:600;color:rgb(0,0,128)">func</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">main()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>g<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">new</span><span style="color:rgb(0,0,0)">(</span>myHandler<span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>http<span style="color:rgb(0,0,0)">.</span>Handle<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"/stream.webm"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>g<span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>err<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span>http<span style="color:rgb(0,0,0)">.</span>ListenAndServe<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">":9001"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">nil</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="font-weight:600;color:rgb(0,0,128)">if</span><span style="color:rgb(192,192,192)"> </span>err<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">!=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">nil</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>fmt<span style="color:rgb(0,0,0)">.</span>Println<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Fucked"</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>log<span style="color:rgb(0,0,0)">.</span>Fatal<span style="color:rgb(0,0,0)">(</span>err<span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-weight:600;color:rgb(0,0,128)">func</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">gstreamerFunc(</span>conn<span style="color:rgb(192,192,192)"> </span>net<span style="color:rgb(0,0,0)">.</span>Conn<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>c<span style="color:rgb(192,192,192)"> </span><span style="font-weight:600;color:rgb(0,0,128)">chan</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">[]</span><span style="color:rgb(0,0,128)">byte</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>q<span style="color:rgb(192,192,192)"> </span><span style="font-weight:600;color:rgb(0,0,128)">chan</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">bool</span><span style="color:rgb(0,0,0)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>buf<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">make</span><span style="color:rgb(0,0,0)">([]</span><span style="color:rgb(0,0,128)">byte</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>RECV_BUF_LEN<span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="font-weight:600;color:rgb(0,0,128)">for</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>fmt<span style="color:rgb(0,0,0)">.</span>Println<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Inside"</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>n<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>err<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:=</span><span style="color:rgb(192,192,192)"> </span>conn<span style="color:rgb(0,0,0)">.</span>Read<span style="color:rgb(0,0,0)">(</span>buf<span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="font-weight:600;color:rgb(0,0,128)">if</span><span style="color:rgb(192,192,192)"> </span>err<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">!=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">nil</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,0,128)">println</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Error</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">reading:"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>err<span style="color:rgb(0,0,0)">.</span>Error<span style="color:rgb(0,0,0)">())</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>conn<span style="color:rgb(0,0,0)">.</span>Close<span style="color:rgb(0,0,0)">()</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,0,128)">close</span><span style="color:rgb(0,0,0)">(</span>c<span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>os<span style="color:rgb(0,0,0)">.</span>Exit<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">1</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="font-weight:600;color:rgb(0,0,128)">return</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">//println("received</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">",</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">n,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">bytes</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">of</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">data</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">=",</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">string(buf))</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="font-weight:600;color:rgb(0,0,128)">select</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="font-weight:600;color:rgb(0,0,128)">case</span><span style="color:rgb(192,192,192)"> </span>c<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><-</span><span style="color:rgb(192,192,192)"> </span>buf<span style="color:rgb(0,0,0)">[</span><span style="color:rgb(128,0,128)">0</span><span style="color:rgb(0,0,0)">:</span>n<span style="color:rgb(0,0,0)">]:</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,0,128)">println</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"received</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>n<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">bytes</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">of</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">data</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">="</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="font-weight:600;color:rgb(0,0,128)">case</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><-</span>q<span style="color:rgb(0,0,0)">:</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,0,128)">println</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"closed</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">normally"</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>conn<span style="color:rgb(0,0,0)">.</span>Close<span style="color:rgb(0,0,0)">()</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,0,128)">close</span><span style="color:rgb(0,0,0)">(</span>c<span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>os<span style="color:rgb(0,0,0)">.</span>Exit<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">0</span><span style="color:rgb(0,0,0)">)</span></pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="font-weight:600;color:rgb(0,0,128)">return</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre></div><div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>Dr. Vasileios Anagnostopoulos (MSc,PhD)</div><div>Researcher/Developer</div><div>ICCS/NTUA 9 Heroon Polytechneiou Str., Zografou 15773 Athens,Greece</div>
<div>T (+30) 2107723404 M (+30) 6936935388</div><div>E <a href="mailto:vanag@mail.ntua.gr" target="_blank">vanag@mail.ntua.gr</a><mailto:<a href="mailto:vanag@mail.ntua.gr" target="_blank">vanag@mail.ntua.gr</a>> <a href="http://www.ntua.gr" target="_blank">www.ntua.gr</a><<a href="http://www.ntua.gr/" target="_blank">http://www.ntua.gr/</a>></div>
</div>
</div></div>