Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

piping from input file instead of process.stdin #23

Closed
dhasl002 opened this issue Jan 4, 2018 · 2 comments
Closed

piping from input file instead of process.stdin #23

dhasl002 opened this issue Jan 4, 2018 · 2 comments

Comments

@dhasl002
Copy link

dhasl002 commented Jan 4, 2018

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!

@marcelklehr
Copy link
Owner

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

@dhasl002
Copy link
Author

dhasl002 commented Jan 7, 2018

Thank you!!

@dhasl002 dhasl002 closed this as completed Jan 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants