Bash RTSP client with netcat - keep connection open while parsing sent data with sed?

2

I am trying to make a RTSP client in bash. Problem is that I must make only one connection to the server through which it will send video frames. I can keep it on one connection up to the point at which server sends me Session ID code that I must use in the following requests (SET_PARAMETER and PLAY). So I must forward netcat's output to sed to get the Session ID, but then my connection gets closed, and after I extract Session ID, I must make a new connection to the server with netcat to start the stream... but there is no video, because I must keep it at only one connection.

So, can I somehow, sed the netcat's output, and echo it back what to send to the server, but not to let it close the connection?

(its the BusyBox netcat)

Cipi

Posted 2010-11-17T10:28:08.347

Reputation: 168

Answers

0

Use tee to duplicate the output to a file and have sed work on that one while the main consumer of the output keeps the connection open.

Martin Vidner

Posted 2010-11-17T10:28:08.347

Reputation: 264