I built a web server which works fine but I've seen some odd behavior with images.
When loading multiple images on a page, one image would sometime would not gets loaded. The browser wouldn't request it from the browser. This would happen only on occasion. I'm wondering if any of you ran into this issue or it could be my network that's the issue.
The other issue I noticed is the images aren't cached on the browser. When I move within html pages, the images would be requested and loaded every time. Shouldn't they be cached and not bother with the server requests? Am I missing a setting?
Am I missing a setting?
Probably depends on what is in your arduino code and the page html.
hmmm. The tags aren’t static content. They are dynamically written with JS/jquery but the image urls are always the same. That could be the caching problem. If I load a html page with static content, the images are loaded from cache.
The occasional missing image is still a weird issue.
Oh, I figured out the missing image problem. While another image is loading, the server is writing bytes to the client, It ignores server requests by the browser for another image.
The browser would signal:
[Error] Failed to load resource: Could not connect to the server. (light.jpg, line 0)
It’s about timing. I’m not sure how to resolve this. The arduino is too simple to multitask/threading?
The arduino is too simple to multitask/threading?
I've made server code that supplies images/files to the browser from the SD card and they all load without issues.
ok, thanks. I'll take a closer look at my code.
Btw, do you turn the SD card pin and W5100 pin off (HIGH) whenever needed?
I'm using the seedStudio ethernet card. Maybe there's something peculiar about it.
The below is the way I handle the ethernet shield/SD card issue.
// disable w5100 while setting up SD