I’m trying to implement https://github.com/rickkas7/photonAudio/tree/master/audio1. Even after following all the instructions, the client.write returns -16. As a result, the buffers are not free, which causes the timerISR() function to skip sampling. This results in very unpredictable behavior everytime I run the code. What I understand is the buffer is full at the server side. Does anyone have any idea how to handle this?
When TCP client write returns -16, it means the internal TCP send buffer is full. You need to repeat sending again. The code handles that, however if your network is not fast enough to handle the data before the buffer rotates back to a buffer in use, you’ll lose blocks of samples.
You’ll either find a closer/faster destination to receive the data, reduce the sample rate, or increase the number of buffers (if you’re sampling a small time length of data).
Thanks a ton.
It was our network connection that was causing the issue. Changing it fixed the problem.