Hey,
There is always a chance that input and output streams have different bandwidth. Like if we are reading a file and sending it somewhere it is read at much higher speed. Result is simple - more and more data is buffered into memory.
Possible solution could be usage of buffered stream, that pauses itself when buffer overflows + "drain" listener on output stream, that resumes it.
Hey,
There is always a chance that input and output streams have different bandwidth. Like if we are reading a file and sending it somewhere it is read at much higher speed. Result is simple - more and more data is buffered into memory.
Possible solution could be usage of buffered stream, that pauses itself when buffer overflows + "drain" listener on output stream, that resumes it.