I am relatively new to programming the arduino. I am currently working with turning the arduino into a webserver. In the process I have been studying the example code entitled Ethernet Shield WebServer, found here https://docs.arduino.cc/tutorials/ethernet-shield-rev2/WebServer.
It looks like every time the arduino loops through the code the client is disconnect, ie client.stop(). When I checked the serial output on my board the client would be connected and disconnected as my laptop was acting as the client, ie displaying the webpage.
I am I getting this right? If so why does the client need to constantly connected and disconnect?
that's what happens. you send the stop only when client.connected() said false
while (client.connected()) {
// handle the request
}
// now client is no longer connected
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();