I am using the command socat to port forward a connection from a real-time live stream.

TCP4-LISTEN:8080 TCP4:123.456.789.12:80

The problem is it has added delay and low fps while the live stream without port forwarding works perfectly without delay and high fps.

  • What might it be causing this?
  • Is there a way to fix this configuring socat or should I use another method?
  • 1
    I'd do this directly using either firewalld or iptables. – slm Jul 8 '18 at 17:47
  • 1
    As you found out, the best option is not relaying it at all – Rui F Ribeiro Jul 8 '18 at 19:13
  • Can you describe this "real-time live stream" in a bit more detail? Is it really a stream? or are there requests/replies involved? Are you using any other options to socat besides those quoted? Have a look at rcvbuf/rcvlowat/rcvtimeo/sndbuf/sndlowat/sndtimeo options. – Murray Jensen Jul 9 '18 at 14:13

I'm not an expert on socat, but after a quick view to its name (SOcket CAT), it seems that it goes through opening two sockets and operating them in user-space.

As slm suggests, why do not configuring it via iptables?

Iptables is a user-space application which configures netfilter. Netfilter code is embedded in the kernel. It may result in a better performance, since forwarded packet does not need to be passed from kernel-space to user-space and vice versa.



In firewalld:

$ sudo firewall-cmd --zone=public --add-masquerade

$ sudo firewall-cmd --zone="public" \

For iptables see this SF Q&A titled: How to do the port forwarding from one ip to another ip in same network?.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.