TCP/UDP Server & Yun

On the Yun, we open a listener on the TCP port 8888 which will forward data to port 6571 of a specified IP (

opkg update
opkg install socat
(socat TCP-LISTEN:8888,fork TCP: &

socat - - SoCat (for SOcket CAT) establishes two bidirectional byte streams and transfers data between them. Data channels may be files, pipes, devices (terminal or modem, etc.), or sockets (Unix, IPv4, IPv6, raw, UDP, TCP, SSL). It provides forking, logging and tracing, different modes for interprocess communication and many more options.

Plan B:

rinetd - 0.62-2 - Rinetd redirects TCP connections from one IP address and port to another. Rinetd is a single-process server which handles any number of connections to the address/port pairs specified in the configuration. Since rinetd runs as a single process using nonblocking I/O, it is able to redirect a large number of connections without a severe impact on the machine.

Plan C:

redir - 2.2.1-1 - A port redirector, used to forward incoming connections to somewhere else.

Plan D:

xinetd - 2.3.15-1 - xinetd has access control mechanisms, extensive logging capabilities, the ability to make services available based on time, can place limits on the number of servers that can be started, and has deployable defence mechanisms to protect against port scanners, among other things.

Plan E:

netcat - 0.7.1-2 - Netcat is a featured networking utility which reads and writes data across network connections, using the TCP/IP protocol. It is designed to be a reliable “back-end” tool that can be used directly or easily driven by other programs and scripts. At the same time, it is a feature-rich network debugging and exploration tool, since it can create almost any kind of connection you would need and has several interesting built-in capabilities.

Plan F:

Port forward with iptables.

Whenever we need UDP Server, Port forward from UDP to TCP.

(socat UDP-LISTEN:8888,fork TCP: &

Help application which display the port is opened:

opkg update
opkg install net-tools-netstat
netstat -nap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0*               LISTEN      864/python
tcp        0      0*               LISTEN      864/python

Among YunBridgeLibrary only Console Class uses TCP port 6571, the rest uses TCP port 5700.