mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1700] ESP32 to ESP32 GET Request = connection refused #1442
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#1442
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SkHCrusher on GitHub (Jan 9, 2024).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1700
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%
@tablatronix commented on GitHub (Jan 9, 2024):
What about a basic example like the ntp one
@SkHCrusher commented on GitHub (Jan 10, 2024):
Firstly, thank you for your answer.
I'm not sure if I've understood you correctly.
Would you like to know if the basic example from the Lib works on the devices from my network?
https://www.arduino.cc/reference/en/libraries/ntpclient/
If that's the question, yes it works... here is the sketch and the result:
NTP Basic Example
Serial Monitor
@tablatronix commented on GitHub (Jan 11, 2024):
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.
@SkHCrusher commented on GitHub (Jan 11, 2024):
But the crazy thing is that it works from a windows computer but not from the esp…
That is confusing. So there must be something different between those both methods… but I can not figure out what it is… and the process looks so stupid simple ;)
@tablatronix commented on GitHub (Jan 11, 2024):
Have you enabled full esp debugging wifi and core level 5?
umm
* Enable SSL validation? but not https right, I mean the server sure seems to be refusing the connection.wrong http version, missing headers perhaps?
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?
404, redirects etc?
Does esp webserver have a max clients of 1?
Missing content type/length?
wm.server->send(200, "text/plain", "hello from user code");@SkHCrusher commented on GitHub (Jan 13, 2024):
@tablatronix I take your notes and do some tests. The result: Still the same problem.
First: Yes i try only http... so no SSL/Securty problem should be the error here.
to
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.
If i send the curl request from the windows computer i get this info:
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....
I checked also that both are in the correct network. Also the ip addresses fits... so there is from my understanding not the issue.
On my Windows computer the first request tooks also longer then the next requests. So my next idea was:
The debug shows that the request timeout was after 5000ms. so i found that this should work (https://forum.arduino.cc/t/webserver-http-get-request-timeout/1011353):
I tried the frist on:
But nothing changed. Still timeout after 5000ms.
My client is the "wm" variable so i added also:
Compiling and upload works... but still timeout after 5000ms.
I searched also in the WiFiManager.h for timeout functions... but all looks more for the portal and not for this request.
So this is my code:
I chosse 11000, 13000 and 15000 only to see if the timout time changed which was the function concerned.
But still:
Hope there is another idea :-/
@tablatronix commented on GitHub (Jan 16, 2024):
I have not had a chance to load these up and test here, and see if wireshark catches anything.
Very strange indeed.
It sounds like the request is not actually going out. maybe try a different port?
@SkHCrusher commented on GitHub (Jan 27, 2024):
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.
@SkHCrusher commented on GitHub (Jan 27, 2024):
Additional information: I am originally trying to communicate with an AZ Node MCU and an ESP-S3.
However, I have also tested the same setup with two NodeMCU's and the result is identical here.
:-(
@SkHCrusher commented on GitHub (Feb 20, 2024):
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:
http.setConnectTimeout(15000);
The "Refuse" problem seems to be a problem with some networks.
When I connect the ESPs to my Fritz-BOX WLAN, I get these error messages and it only works from PC to ESP32.
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.
@tablatronix commented on GitHub (Feb 21, 2024):
Do you have multiple access points, are you talking across aps, or subnets?
@SkHCrusher commented on GitHub (Feb 21, 2024):
My Structure:
Fritzbox 6591 Cable > Asus GT-AX11000
Fritzbox act as router and Asus as AP. Fritzbox delivers services like DHCP.
On my Fritzbox there is a 2.4Ghz Wifi like Wifi1 enabled and on the Asus a 2.4 like Wifi2.
I'm connected over the Asus with Wifi2.
I disabled the autorouting between 2.5 and 5Ghz and all SSIDs are separated. So i can be sure that Wifi2 is only on the Asus AP
There are no special Subnets. All acts in a 192.168.178.* net with fritzbox on 192.168.178.1.
Hope this answers the question :-)
@tablatronix commented on GitHub (Feb 21, 2024):
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?