I uploaded the following sketch to my ESP8266:
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
ESP8266WebServer server(80);
String toServe;
void serveShortString() {
server.send(200, "text/plain", "short string!");
}
void serveLongString() {
server.send(200, "text/plain", toServe);
}
void setup() {
WiFi.softAP("test");
// fill string to serve:
toServe.reserve(3000);
for(int i=0; i<150; i++) toServe += "1234567890123456789\n";
server.on("/long", serveLongString);
server.on("/short", serveShortString);
server.begin();
}
void loop() {
server.handleClient();
}
It serves a short message on /short
and a long message (3000 chars) on /long
.
The /short
page works everywhere: Windows, Desktop Linux (Fedora) and Android.
The /long
page, on the other hand, only works on Windows and most of the time on desktop Linux. It never works on Android. I tried two phones.
I captured the network traffic on my Android phone using tPacketCapture. This is the result:
When trying to get /short
, everything works fine. When trying to get /long
, only the header comes through but the content never arrives. As I said, everything works fine on Windows and (most of the time) on Desktop Linux. Any idea what's going wrong?