Closed Jauwaad closed 3 years ago
There a are differences in wifi/ethernet libraries on do they close the socket in the class destructor or not. Sounds like yours does not. By default the server expects the connection to be closed after every request and because of this the connection: close header is used. The curl is most likely just waiting for the connection to be terminated by the server.
Try changing your loop to something like this:
void loop(){
EthernetClient client = server.available();
if (client.connected()) {
app.process(&client);
client.stop(); // add the client stop here
}
}
As expected the library does not close the socket automatically. It does not have destructor specified at all. https://github.com/arduino-libraries/WiFiNINA/blob/master/src/WiFiClient.h. Manually closing the client after processing should do the trick. This is the fist wifi library that I see working this way around. I will update the readme to contain a compatibility
section.
Calling client.stop() resolved this issue. Thanks for the help. Great library.
Not sure this is because of HTTP 1.1. But the data is retrieved after the curl call times out.