Hi, I am using one NodeMCU and one ESP32-CAM. ESP32-CAM has an webserver on itself and NodeMCU is sending data to that webserver and getting data from that webserver. It is always sending data to it successfully but getting data is not working always.
The code I am using to get data: (There is also a sending data code before this code, it is using same logic and code is nearly identical. I put 1000 ms delay between these operations hoping it is going to help but nothing changed.)
payload = "";
while (payload==""){
http.begin(wifiClient, "http://192.168.4.1/info");
http.addHeader("Content-Type", "text/plain");
int httpCode = http.POST("");
payload = http.getString();
http.end();
}
I couldn't find a fix. Thus, I tried to check if payload is empty or not. However, sometimes it takes so much time to get a payload. Also, httpCode is always 200 whether payload is empty or not. I tried to use GET instead of POST but nothing changed (Ofc I changed server side code for that).
I didn't put full code of NodeMCU and ESP32-CAM because it is very long. Everything except getting data is working flawlessly. Interestingly, the chance of getting data is higher if I connect ESP32-CAM and NodeMCU to computer usb. But, it is still not working always.
The data is not very long, it is only 10-15 bytes. (For example "230,185,0,0").
Is there something I don't know about these protocols?