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)