Closed dhasl002 closed 6 years ago
Ah, I see. process.stdin
is sending data, whenever you type, and you will probably only expect data you typed to end up on the other screen after you see that they are connected. A file stream, when piped, sends its data immediately, though. And if there are no peers at the moment, that data will go to data heaven. So, without seeing your code, my fix would be to pipe only after you get the connected
event.
I'm happy to help you out, btw. It's nice to know people are interested in this piece of software :)
Thank you!!
Hello,
This is my last question. Thank you for your help.
I understand that this line is how the nodes communicate with each other.
process.stdin.pipe(node.broadcast).pipe(process.stdout)
I would like to send text from an input file instead of process.stdin. I have created a both a readstream and a duplex stream to send this input file text, but this does not work. No text is printed on either screen. If I pipe the readstream or duplexstream to the stdout of the node that has changed the text file, text is printed to that screen. What does not work is printing to the screen of the peer that is being sent the text.
Could you possibly direct me what type of stream I would use in place of "process.stdin." Thank you!