how to redirect stdout [binary stream] to multiple processes
I have a program writing to stdout a binary stream of data (which it is extracting from a device). I want to send that stream to two independent processes, and I don't know how. How can I do this?
|
Assuming this is a program that you're writing, simply call dup on STDOUT_FILENO as many times as you need and pipe the reulting file descriptor(s) to whatever programs you want. If it's not a program you're writing, perhaps send the data to a socket and have all your listners reading from that socket (I'm not entirely sure if this will work).
|
i'm just thinking out loud here !
haven't tried or tested any of this seem like you could use named pipes (FIFOs) ok say you FILE* stream = popen ("myOtherProccess" , "w"); then you make another program myOtherProccess so all it does is takes in the data stream and writes in out to two different named pipes then your two other procceses can read from the FIFOs ?????? |
All times are GMT -5. The time now is 06:53 PM. |