localhostwebserverhttpclientesp32getmethod

esp32 connect(): socket error on fd 48, errno: 104, "Connection reset by peer"


I'm working on BasicHTTPClient for send the data from the esp32 cam board to webserver through GET method i have googled about this error can some explain me this error and tell me how to slove it

thank you in advance!


Solution

  • Reset means that either there was nothing listening on the TCP port you tried to connect to (for instance, the web server wasn't running, or you had the wrong port number for it, or there was a firewall blocking access), or if you had already connected that the server your software was talking to abruptly went away (crashed, exited, or a firewall was brought up).

    I noticed that you tagged your question with localhost. If you're attempting to connect to http://localhost or http://127.0.0.1 from the ESP32, that will absolutely not work. localhost is shorthand for "the same computer" - it's not the name of some other computer your web server is running on. If you're trying to connect to localhost from the ESP32, you're trying to connect to a web server running on the ESP32, which is also certainly not the case, and you would in fact get a reset as a response. You need to use the correct name or IP address of the computer you're trying to connect to.