Make sure to always flush output stream after sending a buffer.
Tweak timing for sending of buffers that are partially full.