After some debugging found that we did not have to flush the encoder.
The flushing should only be done completely at the end when no more new packet will receive. In our case never as the listening end most of the time already closed the connection.

Signed-off-by: Michel Verbraak <info@1st-setup.nl>