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 🙂
I’m glad it is solved now. Many times it can be really difficult to figure out what is causing those issues.
I’ll mark this question as resolved.
If you need further help, you just need to open a new question in our forum.
I would like to know what flag was checked in your router. I am having a similar issue where my ESP8266 is connected to my SSID but I can not get to the web server with any browser. Sara, you are familiar with this issue from my post at my own thread. I have not been able to resolve. It looks as thought there is something blocking me from connecting to more than one ESP 8266 Web server( I already have one running at another IP address on the same network)
in my Fritz router it was a setting in the config file: “user_isolation = 1”, when I set it to “user_isolation = 0” my smartphone was able to see the ESP.
Thanks for your response, I am not familiar with that router setting? Ironically I have one ESP8266 board that works with every platform, and two that don’t work with any?
I will do some more research and report what I am able to find.
Did you check if you had any access list or other security active on your router? Maybe you inserted the working ESP in an Access Control List but didn’t insert the other two, for instance. I had similar problem with my wifi network when I forgot to insert the MAC address of my ESPs in my router’s ACL.