It works all fine if I interact with my ESP8266 via my pc browsers. But when I open Chrome on my wifi connected smartphone it can’t connect to the web server.
My phone and the ESP8266 are on the same network. What am I doing wrong?
Thanks for any hint!
What web server are you running?
What browser are you using on your smartphone?
Do you have the web server opened on both browsers at the same time?
I’m running the one showed in “MicroPython_Programming_with_ESP32_and_ESP8266_V1_2” starting from page 144.
I’m using Chrome on my smartphone.
I tried with both browser clients at the same time and with my smartphone browser only. The pc browser (Firefox and Chrome, it’s the same) always works fine, the smartphone browser (Firefox and Chrome) are always “unable to connect”. Of course the same smartphone browsers are ok for every other internet site connection.
Thanks for your help!
I’ve tested the example and what is happening is that Google Chrome opens an additional connection that remains open. Which makes it impossible to make another connection to the web server while it is not closed.
To solve that, we need to add some lines to close any connection after 3 seconds, so that sockets are free for another connection.
Here’s the new main.py code.
Can you try it and see if that solves the problem?
We’ll update that issue in the next eBook update.
I’ll try it now but I don’t think this works: the smartphone doesn’t connect at first try (after resetting the ESP) so it can’t be blocked from anything else previously. I forgot to tell you I tried with different smartphones, too and the result is always the same. It seems the smartphones can’t reach the web servers: Thonny’s console doesn’t show anything while at every try with pc browsers (wired to the LAN) it shows the connection.
Hi Sara, just an update: I tried with your updated version but nothing changes.
As I told you the problem seems to be the connection itself.
Have a nice day.
That’s very weird.
I can access the web server from computer and smartphone and both at the same time.
I don’t know why you’re having that issue.
Are you sure you are really connected to the same network that the ESP32?
What is exactly the error message that you get?
It seems so strange to me, too! The error is a classic “This site can’t be reached” (ERR_ADDRESS_UNREACHABLE). I guessed it could be something in my network but what?
The same smartphones which can’t connect to ESP8266 are usually connected, e.g, to a Xiomi robot for floor cleaning. Yes I checked the IP address of the smartphone wifi and it’s in the same net. It couldn’t be otherwise: I’ve a single DHCP server distributing the addresses.
The last 2 IP in the connection answer of the ESP8266 (after the subnet mask) what represent? DNS? Default gateway?
Update: checking the nets on my smartphone I notice a net “MicroPython-ea8efc” protected by a password: shouldn’t my ESp8266 act as a client only? Why do I see it as if it were a hot spot?!?
And btw how can I know the AMC address of the ESP8266?
It’s ok to have the MicroPython “access point”. I have that too and it works fine.
You can use the following lines to get the mac address
mac = ubinascii.hexlify(network.WLAN().config('mac'),':').decode()
sorry for this very late answer. I wish to share with you that now I can see the ESP 8266 web server on my wireless connect smartphones! It was not an ESP issue: a flag in my router set the separation among wireless devices connected to it. It had to be unchecked for devices to communicate each other but it was deeply “hidden” in others menu. Thanks for your hints.
Nice regards 🙂