LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to redirect stdout [binary stream] to multiple processes (https://www.linuxquestions.org/questions/linux-general-1/how-to-redirect-stdout-%5Bbinary-stream%5D-to-multiple-processes-219722/)

vtaminh 08-19-2004 11:32 AM

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?

btmiller 08-19-2004 12:57 PM

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).

foo_bar_foo 08-19-2004 01:05 PM

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.