I want to receive live TCP stream, and make it readable by another processes at the same time, without saving it.For example, 111.222.233.244:1234 streams actual time. Server supports only one connection.TTY1:$ nc 111.222.233.244 1234 | (do something here) /tmp/tcpstream &$ sleep 5 # stream is received even if there is no process that reads it$ cat /tmp/tcpstream # it can also be like `(some command) | cat -`17:00:0617:00:0717:00:0817:00:0917:00:1017:00:11TTY2 (second cat executed 9 seconds after executing nc):$ cat /tmp/tcpstream17:00:0917:00:1017:00:11
How do I share stdout between multiple processes?
linux;bash;command line;tcp
Perhaps the tcpclone tool can help you. It listens for incoming connections on a certain port, and any data read from standard input is forwarded to those connections.Your example should then become something like this:$ nc 111.222.233.244 1234 | ./tcpclone 5555 &$ nc 127.0.0.1 5555