I'm using a python script to generate data using standard print() arguments. The output from the script should then be sent to localhost tcp socket 9999.
python script.py | nc -lk 9999
On the client side I'm listening to localhost tcp socket 9999 to verify everything is working fine.
nc localhost 9999
And yes, it's working. But it looks like nc is buffering some messages before sending them. As a result, I get huge delays on the client side, which is not acceptable for my application: I need the data asap.
Is there a way to disable the buffer?
I noticed that if I send more messages, the delay decreases. However, this isn't really a solution for me.
nc
never buffers, it always sends data immediately. It's the python program that's buffering because stdout is not a terminal. – Contradict