Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By schufti
#79630
RichardS wrote:I wrote an example to prove the issue.

1. Start CMD on windows machine and issue ping 192.168.4.1 -t

2. Change "your-ssid" and "your-password" to reflect your network.... then Run the sketch

3. find "myhost" in your wireless AP settings on the PC and log in.... (do it quickly you have 20 seconds)

4. you will see ping working

5. in 20 seconds the code will attempt to log onto an AP that does not exist....

6. the ping will start failing.....

WHY?

RichardS

From 1-4 I assume you are connecting your PC via WiFi to the esp-AP (usually on 192.168.4.x).
If you were connected via your home WiFi ping to 192.168.4.x wouldn't work (assuming your home WiFi is not 192.168.4.x).
If you now change the ssid of the esp-AP the PC looses WiFi connection and therefor ping stops working.

to prove my assumptions: skip step 1/3 and find IP of esp on your home WiFi via router status (or print local STA-IP in sketch), ping this IP.

This "problem" should be the same on esp8266 and esp32.
User avatar
By RichardS
#79640
schufti wrote:
RichardS wrote:If you now change the ssid of the esp-AP the PC looses WiFi connection and therefor ping stops working.


I think you have it a little wrong, the SSID that the ESP-AP is sending out does not change, what changes is the STA that its connecting to.

WiFi.mode(MODE_AP_STA);
WiFi.softAP("myhost","myhost"); // does not change
WiFi.begin(ssid, password); // this is what changes this ssid

So when a PC is connected to "myhost" it remains connected to "myhost"

Think of it like this... "myhost" is a bridge to another network.... the pc connects to myhost, then myhost connects to another PC, then the bridge wants to connect to a new PC and tells myhost its changing, and while it changes, the communication to "myhost" to give updates to stops.....

RichardS
User avatar
By schufti
#79646
RichardS wrote:Think of it like this... "myhost" is a bridge to another network.... the pc connects to myhost, then myhost connects to another PC, then the bridge wants to connect to a new PC and tells myhost its changing, and while it changes, the communication to "myhost" to give updates to stops.....
RichardS

then rudy has the correct analysis: the channel used by "myhost" will follow the channel used by "newssid".
The esp only has one receiver/transmitter and the channel chosenfor AP_STA will allways be the last used by either actively setting for AP or passively following host network by connecting in STA mode.
As your PC does not automatically follow the network via SSID (maybe this can be configured*), you loose connectivity and ping fails.
On my Laptop with Win7 it takes some time to automatically find STA on new channel in case I reboot my WiFi router after changing channel ...