-->
Page 1 of 2

send GET request to AP fails

PostPosted: Mon Nov 21, 2016 1:33 am
by lucian
Hello,

I don't know if this is the correct place to ask, but i have an issue and i hope to get some help. I have two ESPs which i use in my project, one is configured to be AP and Server, and the other one is client. The server starts with ip: 192.168.4.1 and deliver a webpage, tested with my smartphone, but when i try to make a request from the other esp, when connecting to host fails. I do following steps:

- connecting to wifi AP - successfully
- preparing data (DHT22)
- creating string and request header
- checking connection to host

IPAddress host(192,168,4,1);

if (client.connect(host, 80)){
it never gets here :(
do something ...
}

So from my phone, when i access ip in browser, works fine, here it does not. Any ideeas?
Btw i use two ESP8266-01 with standard firmware, arduino code.

Re: send GET request to AP fails

PostPosted: Mon Nov 21, 2016 11:30 am
by martinayotte
Is your second ESP in STA-only mode ?
If both ESP are in STA+AP, you will get conflicting IPs with 192.168.4.1, since the client will try to connect to itself instead of trying to connect to the other ESP.

Re: send GET request to AP fails

PostPosted: Mon Nov 21, 2016 1:09 pm
by lucian
the one which is server is STA+AP, but on the client i did not configured specific mode, i just used wifi.begin(ssid, pass), do it connects successfully to the server, it cannot open the connection with its ip. I will try to specifi ST only in the client just to exclude your statement. Thanks

Re: send GET request to AP fails

PostPosted: Mon Nov 21, 2016 9:42 pm
by martinayotte
For the client, to avoid IP conflict, simply force STA-only mode by using WiFi.mode(WIFI_STA); before the WiFi.begin();