-1

Is there any way to listen to a stream input and perform an action like read() whenever a new byte is available?

Holger
  • 267,107
  • 35
  • 402
  • 715

1 Answers1

0

By default read() method blocks in open streams till a new input is provided.
You don't need to do any actions.
Read this
If you mean that blocking until new input receives is not desired, create a separate Thread or Fiber to do that for you.

Community
  • 1
  • 1
Alireza Mohamadi
  • 501
  • 4
  • 19