My java program calls a python script that sends it small JSON strings. I launch the python script using process builder, then wrap the inputstream
in inputstreamreader
and BufferedReader
.
What I've noticed though, is that the program waits until a certain number of messages have been sent to transmit the data to my java application.
I traced this problem to the raw InputStream I get from the Process, because even if I use it alone without BufferedReader I still get this issue. When I increase the size of the messages they are transmitted without any problems. But I only need to transmit short messages every few seconds. This behavior makes me think that the inputstream has some internal buffer that it waits to fill before transmitting the data. Any help with this?