New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32 to ESP32 GET Request = connection refused #1700
Comments
What about a basic example like the ntp one |
Firstly, thank you for your answer. I'm not sure if I've understood you correctly. If that's the question, yes it works... here is the sketch and the result: NTP Basic Example#include <NTPClient.h>
// change next line to use with another board/shield
//#include <ESP8266WiFi.h>
#include <WiFi.h> // for WiFi shield
//#include <WiFi101.h> // for WiFi 101 shield or MKR1000
#include <WiFiUdp.h>
const char *ssid = "****";
const char *password = "****";
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP);
void setup(){
Serial.begin(115200);
WiFi.begin(ssid, password);
while ( WiFi.status() != WL_CONNECTED ) {
delay ( 500 );
Serial.print ( "." );
}
timeClient.begin();
}
void loop() {
timeClient.update();
Serial.println(timeClient.getFormattedTime());
delay(1000);
} Serial Monitor
|
My guess is there is an issue with httpclient and wm, oddly though you are only running autoconnect, so nothing should be started by wm if connect is ok. |
But the crazy thing is that it works from a windows computer but not from the esp… |
Have you enabled full esp debugging wifi and core level 5? umm you can hit it with curl ? I will see if I can test this some day, seems simple enough, cant imagine what it could be, try sending different http resp? Does esp webserver have a max clients of 1? Missing content type/length? |
@tablatronix I take your notes and do some tests. The result: Still the same problem.
wm.server->send(200); to wm.server->send(200, "text/plain", "hello from user code"); Still "connection refused". But i leave this for the next tests.
Debug from Server:
If the Request from the other ESP is send there is no debug output.
So strange and different. After this I enabled also the debug for the requester ESP. Here is the log:
For each request, this log added additionaly:
So it is crazy... there is a timeout.... On my Windows computer the first request tooks also longer then the next requests. So my next idea was:
http.setTimeout(20000);
client.setTimeout(20000); I tried the frist on: http.setTimeout(20000); But nothing changed. Still timeout after 5000ms. wm.setTimeout(20000); Compiling and upload works... but still timeout after 5000ms.
http.setTimeout(20000);
wm.setTimeout(20000);
wm.setConfigPortalTimeout(11000);
wm.setConnectTimeout(13000);
wm.setSaveConnect(15000);
http.begin("192.168.178.156", 80, "/demo"); I chosse 11000, 13000 and 15000 only to see if the timout time changed which was the function concerned.
Hope there is another idea :-/ |
I have not had a chance to load these up and test here, and see if wireshark catches anything. It sounds like the request is not actually going out. maybe try a different port? |
Sorry for the delay. I have tried to set the port to e.g. 8080... This change does not change the behaviour either.
From the PC I can make the call with :8080. Not from the other ESP. |
Additional information: I am originally trying to communicate with an AZ Node MCU and an ESP-S3. :-( |
I have a few more insights, but they don't really solve my problem. The simplest first: I was able to set the timeout successfully with the following command: The "Refuse" problem seems to be a problem with some networks. If I install a router without Internet and connect both ESP32s there, both can communicate without problems. Unfortunately, I'm not a WLAN expert, which is why the ESPs don't work in my normal network. |
Do you have multiple access points, are you talking across aps, or subnets? |
My Structure: Fritzbox 6591 Cable > Asus GT-AX11000 Fritzbox act as router and Asus as AP. Fritzbox delivers services like DHCP. Hope this answers the question :-) |
The only thing I was thinking was some mdns or multicast issue but for regular http/tcp this shouldn't even be an issue. Have you tried anything like setting your esp to use a speciic phy mode? |
Basic Infos
Hardware
WiFimanager Branch/Release: Master (from 01-09-2024)
Esp8266/Esp32: ESP32
Hardware: ESP32-S3, ESP32-S2, AZ Delivery ESP32
Description
I have two ESP32 modules with the Wifi Manager. One ESP32 offers an additional endpoint and the second ESP should trigger this endpoint.
The ESP32 always reports "connection refused" after the request.
If I call this with a tool like Insomnia from a Windows PC, I get a valid response.
At first I thought that I had conflicts with other libs in the project. However, my example here is reduced to the minimum and I can also reproduce the problem here.
I have also tested several modules (ESP32 Dev, ESP32-S2, ESP32-S3). The same result everywhere.
I hope that I am overlooking something simple the last few evenings and someone has a solution to the problem.
Sketch Server
Sketch Requester
Comment: Yes the IP address is fixed set to "192.168.178.156" in my network. But also with a dynamic address, it doesn't work.
Debug Messages ESP Requester: Does NOT work
Debug Messages Insomnia: works 100%
The text was updated successfully, but these errors were encountered: