I've based a sketch off the vanilla WiFi101 server examples.
If I define a const char array like this:
const char HTML_index = "<html><head></head><body>test</body></html>";
The server works well. However if I increase the char size to about 1,300 bytes the server fails to send a response. The device (Feather M0 WiFi) doesn't lock up, I can continue to make HTTP requests and the serial console functions correctly, just no HTTP response. The device and laptop (client) are both on the same WiFi AP so nothing weird there.
First I thought this was a memory issues, but as I'm using newer architecture and IDE using
const should ensure the string is in FLASH.
So I then read some threads about buffer limits per response using other libraries: https://github.com/esp8266/Arduino/issues/3205
But again not sure how applicable this is to an ARM based system/ WiFi101 library.
Is there a limiting buffer size etc when sending HTTP data in my setup? Do I need to split the string up into smaller pieces and send multiple responses? How could I go about debugging this situation?
Edit: This is the example sketch my code is based off: https://www.arduino.cc/en/Tutorial/Wifi101SimpleWebServerWiFi
Edit2: ok I think I know what's going on but can't test right now, will post an answer when I do. I found this thread https://github.com/arduino-libraries/WiFi101/issues/163 which talks about SOCKET_BUFFER_UDP_SIZE. So I looked through the WiFi101 src and found this:
#ifdef LIMITED_RAM_DEVICE #define SOCKET_BUFFER_SIZE 64 #else #define SOCKET_BUFFER_SIZE 1472 #endif
It's likely that my string was actually over 1472 bytes so this makes sense.
Edit3: Found more references:
So I take it the 1500 in WINC1500 could mean the buffer size. Either way looks like there's a hardware buffer limit and responses larger than ~1400 bytes need to be chunked.