Hi everyone, I am using pico with W5500. I am using this library githublink. I am using http get and post requests. Everything works fine. I am using get request from this api api.example.com/api/9873214 . This one is not real api , it is example. This 9873214 is a variable so it can be change. When this variable change to empty string api.example.com/api/, http get request gives 404 error and than it gives
// The response from the server is invalid, is it definitely an HTTP
// server?
static const int HTTP_ERROR_INVALID_RESPONSE = -4;
After this error, ethernet can't connect client even if I use ,
if (statusCode == -4)
EthernetClient client;
EthernetHttpClient httpClient(client, serverAddress, port);
uint16_t index = millis() % NUMBER_OF_MAC;
Ethernet.begin(mac[index], 1000);
So, how can ethernet connect internet after 404 error or status -4 error ?
I realize, after 500,502,503,504 error, it gives status code -4 and ethernet can't use http get or post request but I can observe the orange light flashing on the w850io (it seems to be flashing when there is internet)
The posted code doesn't have 2500 lines. And it doesn't compile!
Ethernet? The Ethernet library doesn't give a status code in your code. In your code the HTTP client library returns some status codes but they are not originating in the Ethernet library.
Add it where? That code probably won't compile (no block delimiters).
What does "can't connect Internet" mean?
You didn't add that in the posted code.
Have you tried to call httpClient.stop() if you received a statusCode other than 200? The library you're (probably) using is quite stateful, so you have to reset the state if you don't follow the expected call order.
The posted code doesn't have 2500 lines. And it doesn't compile!
2500 line code is really mess. I wrote without using class and voids so its really messy. That's why I didn't post it here.
Ethernet? The Ethernet library doesn't give a status code in your code. In your code the HTTP client library returns some status codes but they are not originating in the Ethernet library.
Yes, I couldn't find the problem and thought the wrong place was the problem, sorry.
What does "can't connect Internet" mean?
As I said, I defined my problem wrong. I should say it doesn't connect server, I guess.
Have you tried to call httpClient.stop() if you received a statusCode other than 200? The library you're (probably) using is quite stateful, so you have to reset the state if you don't follow the expected call order.