title: Gstreamer: udpsink/udpsrc versus tcpserversink/tcpclientsrc
body: <p>I'm very new to gstreamer but after a lot of research I've now managed to create my own working pipeline streaming a webcam over a network from a Raspberry PI Zero to a PC via a UDP transport. I am pleased with my progress! :)</p>
  
  <p>But I'm struggling to create a TCP transport...</p>
  
  <p>This pipeline works perfectly over UDP:
  (<em>note: simplified using a test video source and JPEG encoding</em>):</p>
  
  <pre><code>Server UDP (192.168.2.1):
  gst-launch-1.0 videotestsrc is-live=true ! jpegenc ! rtpjpegpay  ! udpsink host=192.168.2.13  port=7001
  
  Client UDP (192.168.2.13):
  gst-launch-1.0 udpsrc port=7001 ! application/x-rtp,encoding-name=JPEG ! rtpjpegdepay ! jpegdec ! autovideosink
  </code></pre>
  
  <p>...but when I use a TCP sink/source with <em>exactly the same elements</em> I receive nothing but errors.</p>
  
  <p>The modified pipeline using <em>tcpserversink</em> and <em>tcpclientsrc</em>:</p>
  
  <pre><code>Server TCP (192.168.2.1):
  gst-launch-1.0 videotestsrc is-live=true ! jpegenc ! rtpjpegpay  ! tcpserversink port=7001
  
  Client TCP (192.168.2.13):
  gst-launch-1.0 tcpclientsrc host=192.168.2.1 port=7001 ! application/x-rtp,encoding-name=JPEG ! rtpjpegdepay ! jpegdec ! autovideosink
  </code></pre>
  
  <hr>
  
  <p>Attempt 1: <strong>tcpserversink port=7001</strong></p>
  
  <pre><code>ERROR: Failed to connect to host '192.168.2.1:7001': No connection could be made because the target machine actively refused it.
  </code></pre>
  
  <p>Attempt 2: <strong>tcpserversink host=localhost port=7001</strong></p>
  
  <pre><code>ERROR: from element /GstPipeline:pipeline0/GstTCPClientSrc:tcpclientsrc0: Could not open resource for reading.
  </code></pre>
  
  <p>Attempt 3: <strong>tcpserversink host=127.0.0.1 port=7001</strong></p>
  
  <pre><code>ERROR: from element /GstPipeline:pipeline0/GstTCPClientSrc:tcpclientsrc0: Could not open resource for reading.
  </code></pre>
  
  <p>Attempt 4: <strong>tcpserversink host=192.168.2.1 port=7001</strong></p>
  
  <pre><code>ERROR: from element /GstPipeline:pipeline0/GstTCPClientSrc:tcpclientsrc0: Internal data stream error.
  </code></pre>
  
  <p>Attempt 5: <strong>tcpserversink host=0.0.0.0 port=7001</strong></p>
  
  <pre><code>ERROR: from element /GstPipeline:pipeline0/GstTCPClientSrc:tcpclientsrc0: Internal data stream error.
  </code></pre>
  
  <p>I figured I should be able to replace src &amp; sink elements without the pipeline breaking so I must just be missing something.</p>
  
  <p>I would be grateful for any light you could shed on this.</p>