MKR1000 Wifi101 Buffer Underrun in client.available()

Hi folks, I just finished up a project using the MKR1000, and I had some trouble reading the body of HTTP POST requests because WifiClient available() would return zero when there was more data pending from the client. It seemed to happen around 1450 bytes, but I can’t recall the exact number.

Anyway, my fix was this, and I am posting it here in case it is helpful. I had to use this whenever reading the body of a POST request.

              bool done = false;
              unsigned long lastTime = millis();
              while (!done){ 
                  if (client.available() > 0) {
                    char c =; 
                    lastTime = millis();
                  //Check to see if bytes are still arriving
                  unsigned long now = millis();
                  if ((now - lastTime) >= 100) {
                      done = true;

In this example, I am not doing anything with the result of, but it’s where you would do whatever you want with the data.

Here “client” is from this: WiFiClient client = server.available();