The message that is returned with that error gives several good suggestions as to how to avoid that error. I would try those suggestions:
"Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem."