Punit Soni
Punit Soni

Reputation: 1299

gstreamer tcpclientsink connection refused

Hi I am trying to stream data from linux box (Raspberry Pi) to Macbook pro using gstreamer-1.0.

On Raspberry-Pi (Linux)

pi@raspberrypi:[~]$ gst-launch-1.0 filesrc location="video.h264" ! tcpclientsink host="192.168.1.140" port=5000
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstTCPClientSink:tcpclientsink0: Could not open resource for reading.
Additional debug info:
gsttcpclientsink.c(366): gst_tcp_client_sink_start (): /GstPipeline:pipeline0/GstTCPClientSink:tcpclientsink0:
Failed to connect to host '192.168.1.140:5000': Connection refused
Setting pipeline to NULL ...
Freeing pipeline ...

On Mac

punits@punits-mac:rover $ gst-launch-1.0 -v tcpserversrc port=5000 ! fakesink
Setting pipeline to PAUSED ...
/GstPipeline:pipeline0/GstTCPServerSrc:tcpserversrc0: current-port = 5000
Pipeline is PREROLLING ...

Using client and server both on raspberry-pi localhost works fine. Please let me know what am I doing wrong.

Upvotes: 3

Views: 6626

Answers (3)

Dmitry
Dmitry

Reputation: 1716

You need to set the host for tcpserversink:

gst-launch-1.0 -v tcpserversrc port=5000 host=0.0.0.0 ! fakesink

The host parameter is where your server accepts the requests from.

The 0.0.0.0 value means the server would accept requests from any address. If you don't set it then it defaults to the localhost which as a rule then resolves to 127.0.0.1. It would imply the server accepts request from the same host, and refuses from others, as in your case.

Upvotes: 0

Chris Maes
Chris Maes

Reputation: 37782

I encountered two main reasons why I also had connection refused:

  1. if host is not specified; tcpclientsink uses ipv6 instead of ipv4.
  2. the server was not listening; which gives the "Connection Refused" error. You must launch the server first!

Upvotes: 2

user2874380
user2874380

Reputation: 1

I remember that in gstreamer0.10 by default the tcpserversrc listens on localhost only. I guess that in gstreamer1.0 it might be the same.

Try to use property "host=xxx.xxx.xxx.xxx" in order to specify your external ip address.

Upvotes: 0

Related Questions