-->
Page 1 of 1

SPIFFS streamFile not working properly on Android but on PC

PostPosted: Thu Aug 09, 2018 12:56 pm
by MasterFX
I've been running into a problem on my very simple webinteface (see attachment).
All my data is on my SPIFFS file System.
If I open any file (e.g. http://192.168.0.120/xyz.bmp) which is bigger than > ~20 kB the android device with Chrome 68 (and less) it doesn't load the page. If I load the same address with an ~80 kB File on PC (with Chrome 68 or Edge) everthing seems to be fine (load time about 390ms according to Chrome DevTools).
On an Android device it loads forever. I have an Terminal output for Request "handleFileRead" and "Sent file: xyz". And I can see that the "Sent file" output take way more longer when I open up the page with the android device.

Re: SPIFFS streamFile not working properly on Android but on

PostPosted: Fri Aug 10, 2018 3:15 pm
by MasterFX
Okay I just added "Serial.println(String("\tSent size: ") + sent);"
When I load the image from PC I get
handleFileRead: /test.bmp
Sent file: /test.bmp
Sent size: 90054

And from Android:
handleFileRead: /test.bmp
Sent file: /test.bmp
Sent size: 2920

2920 is 2x 1460 which is the MTU. Do we have a bug here?

Re: SPIFFS streamFile not working properly on Android but on

PostPosted: Fri Aug 10, 2018 5:41 pm
by MasterFX
interestingly it works with 2,3,0 even if it is much slower. The main difference seems to be;
2.3.0: return _currentClient.write(file, HTTP_DOWNLOAD_UNIT_SIZE);
2.4.1: return _currentClient.write(file);

Whereas HTTP_DOWNLOAD_UNIT_SIZE = 1460. Why it has been deleted? Well it seems to be faster when MTU is higher, but who cares if it isn't working on every device?