I'm making a web server.
I the Ethernet shield and uses a SD card because my website have pictures.
The pictures won't come out (I already put it in my SD card and it worked on the computer).
I want to make it public.
I failed.
Your server doesn't serve images, only the main page. You don't even read what is requested by browser and always return the page
here is my complex WebServer if you can extract what you need, You don't need the REST/JSON/AJAX parts of it, but you need the file serving from SD card.
Juraj:
Your server doesn't serve images, only the main page. You don't even read what is requested by browser and always return the page
here is my complex WebServer if you can extract what you need, You don't need the REST/JSON/AJAX parts of it, but you need the file serving from SD card.
Can you briefly explain how that library works? I can't understand it.
And what is REST/JSON/AJAX.
I also want to know how long the Arduino can remain powered before it get brokened because I'm afraid that when I run the Arduino for to long and it broke.
Arduinos don't easily break. People have them running for years.
What happens when a web browser requests a page from a server?
The server sends the page to the browser. The browser analyses it and sees e.g. an image tag. The browser will then request the image (that is specified in that tag) and the server will send the image to the browser. Same principle for e.g. a CSS file or a javascript file.
So your code must be able to handle the needed browser requests.
DolphinPig28:
Can you briefly explain how that library works? I can't understand it.
And what is REST/JSON/AJAX.
It is not a library. It is part of a 'multi tab' sketch. NetServer and NetClient are aliases for EthernetServer and EthernetClient (or WiFiServer/WiFiClient). You would copy is and remove the parts you don't need
To write a HTTP server you must know HTTP protocol. (and how to code)
Juraj:
It is not a library. It is part of a 'multi tab' sketch. NetServer and NetClient are aliases for EthernetServer and EthernetClient (or WiFiServer/WiFiClient). You would copy is and remove the parts you don't need
To write a HTTP server you must know HTTP protocol. (and how to code)
When I verify your code, there's a lot of errors such as 'NetServer' does not name a type
What happened? Or it is because my IDE is not compatible with this?
Can you just tell me which part to delete? There's many part about JSON but nothing about AJAX and REST.
DolphinPig28:
When I verify your code, there's a lot of errors such as 'NetServer' does not name a type
What happened? Or it is because my IDE is not compatible with this?
Can you just tell me which part to delete? There's many part about JSON but nothing about AJAX and REST.
Tho project can run on WiFi or Ethernet so the "Net" is defined as Ethernet or WiFi.
Change it for you to EthernetServer/Client.
I included Ethernet library and I solved the declare error.
But there's a new error: expected unqualified-id before '/' token
It's the "/"in EthernetServer/Client.
DolphinPig28:
I included Ethernet library and I solved the declare error.
But there's a new error: expected unqualified-id before '/' token
It's the "/"in EthernetServer/Client.