I'm using MLwifi to connect to an ESP8266 in AP mode and configure it. After configuration I want to swap back to my original WiFi connection and continue connected to the original WiFi network.
I can successfully connect to the ESP8266 and send the configuration information. I then force the ESP8266 to reboot (so the AP disappears).
The problem is that when I reconnect to my original WiFi my app can no longer communicate via http.
Here is a log:
On returning to the original WiFi my phone correctly connects to my WiFi and I can browse/ping etc. but my app returns a SocketException.
I use the disconnectWiFiAP to disconnect and connectWiFiAP to connect to the ESP8266 then disconnectWiFiAP to disconnect from the ESP8266 and let the phone reconnect to the original WiFi network.
I have tried forcing a connection to the original WiFi using connectWiFiAP but that returns an error saying it's not available. Just letting it reconnect itself seems to work for everything except my app. If I restart my app it then correctly connects and can communicate with the device at 192.168.0.105
Is it possible that my app is trying to communicate via the 4G network instead of the WiFi network?
I can successfully connect to the ESP8266 and send the configuration information. I then force the ESP8266 to reboot (so the AP disappears).
The problem is that when I reconnect to my original WiFi my app can no longer communicate via http.
Here is a log:
Reconnect to original WiFi:
[MLwifi] Connected to PCSystem
Connected to WiFi = true
'/// Disconnect pressed
disconnectWifiAP = true
Wifi_ConnectionResult = true
Connected - false
IP address - 192.168.4.2
Is online - true
SSID - PCSystem
5GHz - true
Ping returned true
'/// Disconnect pressed again
disconnectWifiAP = true
Wifi_ConnectionResult = true
Connected - true
IP address - 192.168.0.119
Is online - true
SSID - Terrapico
5GHz - true
Ping returned true
'/// Now a call to 192.168.0.105 which is on the network and is active and will return data
ResponseError. Reason: java.net.SocketException: socket failed: ENONET (Machine is not on the network), Response:
Website response (settings):java.net.SocketException: socket failed: ENONET (Machine is not on the network)
On returning to the original WiFi my phone correctly connects to my WiFi and I can browse/ping etc. but my app returns a SocketException.
I use the disconnectWiFiAP to disconnect and connectWiFiAP to connect to the ESP8266 then disconnectWiFiAP to disconnect from the ESP8266 and let the phone reconnect to the original WiFi network.
I have tried forcing a connection to the original WiFi using connectWiFiAP but that returns an error saying it's not available. Just letting it reconnect itself seems to work for everything except my app. If I restart my app it then correctly connects and can communicate with the device at 192.168.0.105
Is it possible that my app is trying to communicate via the 4G network instead of the WiFi network?