-1

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

Holger
  • 285,553
  • 42
  • 434
  • 765

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
  • 511
  • 5
  • 19