-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ESP 8266 HTTP Client Connection Failure #5552
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
Comments
The debug messages show that the WiFiClient connection fails, which is consistent with the following http client refused message. I'd say the cameranis refusing the connection for some reason. |
@devyte |
I said:
My suggestion: use wireshark and investigate the difference in communication between a browser and the ESP. Then figure out what is needed to get the ESP to succeed like the browser. It could be something as simple as a missing header, or pairing, or something more complex. Or it could be a bug, in which case you have to show what is wrong in the core. |
You can try using any tcp server like netcat / nc and address your requests to it. It will print the request (from your browser, or from the esp) so you can make the difference.
Then you can use again |
Thanks for the advise. David Gauchard, I used your method and printed out the Get Requests from my browser and from the ESP, noted the differences and adjusted the GET Request from the ESP. I tried the new request with the GoPro and it still failed :( Then I realized that the issue is not with the GET Request, but with the client.connect() statement. It fails here and never gets to the GET request. Is there anything I can change with the client.connect() to prevent it from failing? Thanks |
I've also tried using Wireshark and can successfully capture all the tcp communications when sending the commands from the browser, but do not know how to capture the requests between the esp8266 and the gopro (when connected to the gopro network, wireshark in promiscuous mode does not capture any of the packets). I think the key to finding the solution is the fact that:
Does that provide any useful insight? I've been working at this for a long time. Any help is greatly appreciated! Thanks |
ESPGoodies on my GH page provides tcpdump (local, or remote for wireshark) from inside the esp8266 You can also go into tests/host and try experimental native build for your computer |
@d-a-v Sorry about my lack of knowledge, but could you explain how to display the tcpdump using either netcat of wireshark. I added the tcpdump code to the esp8266, but I cannot seem to access it. Thanks ahead of time. |
Another point of interest that may be helpful is I can ping the esp8266 from my computer, but I am not able to ping the gopro itself (all connected to GoPro's AP). |
Well, I worked at it some more and I was able to see the tcp dump in the terminal with netcat using the following command:
Here is some of the output:
However, it only worked when the client connection was up and running (right after I reset the gopro). Otherwise, it returned this error in the terminal:
Here is the output when communicating with the GoPro from the browser: Can anyone tell if there is a useful difference between these two communications? |
I have a new theory that I've been trying to test. The ESP8266 only works on the 2.4GHz Band. The GoPro Hero 5 is dual band (5 & 2.4) with no specific prioritization as seen here: The later GoPero models (6 & 7) allow you to select the WiFi band, but the 5 does not. Unfortunately, I do not have a Hero 6 or 7 to test with (yet). I've looked at the connection properties from my computer (both when the ESP commands are working and not working) and it always shows 2.4GHz. Is there any way that it would be trying to connect to the ESP at 5GHz and the computer at 2.4? If this is the issue somehow, it would explain a lot of the symptoms... Does anyone have any insight? Or, any way to determine the WiFi frequency or set a preferred frequency on the ESP? I've tried specifying a channel in the WiFi.begin() command, but I realize that it is a subchannel on the 2.4GHz band. Thanks |
The ESP is 2.4 only. |
Unfortunately, I have not solved the issue yet. Does it work for you on the 2.4Ghz, 5Ghz or neither band? |
@nespotts Have you tried using |
I've not tried creating a mock http server (instead of GoPro's) with netcat, but that is a good suggestion. I may be able to try that in the next couple days. However, from what I have observed in the past, it does not appear to be an issue with the http request, but fails even before that, with the client connection and possibly with the WiFi connection (not able to ping ESP). This is why I am looking into the WiFi band issue with the Hero 5. I am receiving a Hero 6 to test today (can select 2.4Ghz or 5Ghz manually). |
I was focusing on that message cited above:
Maybe a "connection: close" or some other http protocol header is not correctly sent / honored |
Gotcha, I will definitely try your suggestion. I have experimented with the http protocol headers a decent amount, but if I post it here (using the nc method suggested) you very well may catch something. |
With the 5hz it won't detect. so I have to manually select the 2.4hz and then it will detect it and connect. After the restart of the gopro it works fine the first time, then it says the connection is made but the http commands not go through. Exactly as you described. |
Hi @devyte, i have the exact problem. Did you find any solution ? |
Hello, In my opinion, problem not comes from the server side, but it comes directly from: In my console I found:
and the no buf for action frame comes from libnet80211.a (NONOSDK). |
@myinventions this is a new problem not much encountered "no buf for action frame" (from nonosdk).
|
OK, I will collect more info and mcve and open new issue. Strange, that "no buf for action frame" is located inside library libnet80211.a but not visible in source codes (but action frame is used in esp_wifi_internal_tx, so maybe memory related problem...) |
Basic Infos
Platform
Settings in IDE
Problem Description
I am having issues sending HTTP GET requests to a GoPro Camera. I have gotten this to work for 3 different GoPro cameras, it is just the newer Hero 5 that is giving me problems. It is probably something simple, but the client connection works and the HTTP requests work right after the wifi connections have been reset on the camera, but if the ESP8266 is reset after a first WiFi connection, it connects to the WiFi fine, but all HTTP requests return a -1 HTTP Code and the client fails to connect.
I've tried calling client.flush(), client.stop() and just about anything else I can think of or find online. The only way to make the commands work again is to reset the WiFi connections on the camera. If I connect using my computer, I have no problem sending the commands from Google Chrome as shown in the attached picture. I've tried using the regular ESP8266WiFi library and the ESP8266HTTPClient library as shown below. Any help would be appreciated! Thanks
Arduino IDE Sketch
Debug Messages
This is just the debug messages generated via the Serial Port (Debug Level = HTTP_CLIENT). The sketch output is intermixed with the debug messages.
If you need any other details, please let me know. Thanks!
The text was updated successfully, but these errors were encountered: