STA or AP mode browser unable to connect to ESP8266-12 #5647
Replies: 1 comment
-
Posted at 2017-02-19 by Ollie Test Telnet. Connect on port 23 from Posted at 2017-02-19 by Wilberforce Please note nothing is listening on port 80 unless you actually start a server listening on that port. http://www.espruino.com/Internet
Posted at 2017-02-20 by Robin @ollie, thank you for your quick reply - was hoping there was an alternate option above in case "If works" failed ;-) Had actually tried that with several IP:Port selections. After I have entered the IP:Port in the 'Connect over TCP Address' edit field and attempt to connect using the Orange button in the upper-left of the WebIDE I get, after a five second wait, a Red 'x' and 'Connection Failed' in lower right hand corner of WebIDE. I'm never able to get a dedicated :23 port to connect. The puzzling part, why am I able to ping from the command line? (low-level) but unable to connect from browser, nor the WebIDE via telnet. I'm tempted to reflash back to older 1v84 as I did see browser activity one time, but only after I had manually entered ssid and p/w into http.connect() method. Posted at 2017-02-20 by Robin Good catch @wilberforce. I re-checked my listen(8080) and now notice that Fiddler and the browser response are indicating '80' when I actually specified '8080' I have seen '80' as a sort of shorthand for the default http '8080' but not sure if their response now, is an indicator or if we have stumbled upon a clue here. Posted at 2017-02-20 by Ollie When you wrote this
You're setting up the server to listen on port 8080 i.e You need to contact the server using the port it is listening on - if that is port 80 you can omit it. Beyond that you need to have a response handler - your Edit: Posted at 2017-02-25 by Robin Sat 2017.02.25 Quoting King Arthur had to consult "The Book of Armaments!" I have previously used port 8080 as an alternative to no port specified when using http. Bewildered when omitting that and the browser wouldn't connect. Confirmed that :8080 is an official alternative for :80
and also at: https://www.reference.com/technology/port-8080-used-ca5f438b749de7de
What I found during testing is that the wifi.connect() function takes the .listen(8080) port reference literally, requiring the absolute use of 192.168.1.71:8080 in the address field of the browser. It is not recognized as an alternative to http browser requests, if not included. This subtle difference forces the use of .listen(80) when it is desired that no port is specified. Posted at 2017-02-25 by Robin Sat 2017.02.25
but only when connected as a station. It is also required to be able to connect via code or a command in the WebIDE left panel. I'm still struggling with connecting to the ESP8266-12 using a 192.168.4.1 request only from the browser in ap mode. The browser never connects and times out.
I have been successful at connecting as a station and using wifi.getAPIP(), wifi.getAPDetails(), wifi.getIP(), wifi.getStatus() (see post #1 above) to view the status while viewing responses from the browser when in station mode. A request of 192.168.4.1 is never recognized in ap mode as seen by wifi.getStatus() Even tried forcing the IP
but found function setAPIP() is not available in
and the module I have wont accept a (re)flash of 1v91 http://forum.espruino.com/comments/13481959/ I have used Chrome's suggestion to to verify there is no proxy server set and made sure the LAN setting 'Automatically detect settings' is set. I have turned off the firewall and disabled anti-virus during testing. Currently at a loss for other ideas to test out. Posted at 2017-02-25 by @MaBecker Hi @robin, by default the AP is active, use this calls to check
A browser connection to 192.168.4.1 will only work if are attached to that AP and when added code like Ollie pointed out above. Posted at 2017-02-25 by Robin Hi @MaBecker, I've been using your example along with modifications that are at the 'Internet' page that Ollie pointed out. Each time, the browser page only pops up when the browser is pointed to the exact IP (192.168.1.71) that can only be detected after inspection of the 192.168.1.254 router table. I'm attempting to get a page to render at 192.168.4.1 as the IoT device powers up, just as a PC or TV might connect as they power up. Am I to understand from your last response, that it is not possible using the current version of Espruino, unless one hard codes the values in script or does a 192.168.1.254 router lookup first to then type in that IP addr into the browser addr field? Could the development platform be the issue. I believe Ollie uses a Mac, I'm using Windows 10 What development platform is you PC? Posted at 2017-02-25 by @MaBecker I use a Mac too. Does ping 192.168.4.1 work for you ? Posted at 2017-02-25 by @MaBecker if pings works your pc is connected to ESP AP than add this code and connect to http://19.168.4.1:8080 with a browser
Posted at 2017-02-25 by Robin Mark, Thank you. This is puzzling as I mentioned I was able to ping the device in post #1 above.
Unable to get the router to forget the IP using factory defaults without the possibility of having to make a service call at cost from a device reset. This might rule out whether Windows 10 or the router is part of the issue. I note that sta is not config:
Posted at 2017-02-25 by @MaBecker post #1 shows a disabled AP, so now way to ping 192.168.4.1 of the ESP AP. The station of the ESP is active, so do http://192.168.1.71:8080 Posted at 2017-02-25 by @MaBecker A http server can run on ESP AP and Station, so no need to start AP if Station is ok for you. Posted at 2017-02-25 by Robin Big clue, If I use:
such that I have the sta config along with the ap
now, I'm not able to ping 192.168.4.1 'Request timed out' which explains why the browser won't connect. Can ping 192.168.1.71 Now the big question, why am I not able to ping? No proxy enabled, Firewall off and disabled virus scan. Points to Windows 10 to me. Also tried tracert
Edit Sat 2017.02.25 Getting closer. For those on a 2Wire ATT UVerse gateway/router - (likely USA) setup a static IP address of 192.168.4.1 Now I am able to ping the ap and the sta, but still am unable to access via a browser page. Maybe that will be cured with a Windows 10 reboot. Will have to wait for that . . . . Posted at 2017-02-25 by @MaBecker Empty stations list means that no station is connected to SSID ESP_88F4A0. You can only ping ESP AP 192.168.4.1 if you join SSID ESP_88F4A0 Posted at 2017-02-25 by Robin Ah, good point Mark, Even though I'm getting a 'connected' reply using the snippet above, the stations array is still In case our posts crossed, after a static router config I am now able to ping 192.168.4.1 through a cmd window, however browser still wont connect. Is there a ping equiv using the WebIDE? Incidentally, thank you for staying responsive while I test. I'm in the CST time zone in the USA, where are you located? Posted at 2017-02-25 by @MaBecker http://192.168.1.71:8080 works because your PCs is in the same network as the ESP-Station Connect you PC to SSID ESP_88F4A0 and http://192.168.4.1:8080 will work. Sorry, but what are you trying to achieve ? Edit: located in Germany Posted at 2017-02-25 by Robin Amazing this Internet thing, how we are able to have near instant communication while 3000+ mi apart! It must be getting late for you so I'll attempt to wrap up.
I must brush up on my German as apparently I'm not getting my point across. ;-) I'd like my IoT device to power up in a state where the user need only type 192.168.4.1 into the browser to gain access to a web page that would enable them to enter their ssid and p/w to gain access. I attmepted the JoinWifi.js example you created, but could only get a web page to render after I had viewed the router settings 192.168.1.254 and visually acquired the IP in order to enter that into the browser. Trying 192.168.4.1 was futile. It will be near impossible to provide simple connect instructions to users that most likely wont have a clue about router IP settings, nor how to diagnose. Look at the issues I'm having, despite having a bit of a clue as to how to continue. My problems were compounded by the fact the IoT device is not connected to the PC via wifi directly. It is actually connecting via the router as indicated by the failed tracrt report. That gave me the clue that maybe my TV configured router may have the default ap mode disabled. No clue why I didn't think of that a week ago despite everyone indicating that 192.168.4.1 is a known ap default. Could the stations array [ ] be a feature completed after 1v89 ? Still, with all the progress today, still am unable to connect via the browser. Maybe a reboot is now required. Thank you for your continuing assistance. Posted at 2017-02-25 by @MaBecker
OK - let me try to explain a possible way how to manage this:
Is this what you are thinking of ? Posted at 2017-02-25 by Robin Simple answer, yes
What is the process of 'connect to the ESP AP' Isn't the browser doing just that when we type 192.168.4.1 into the addr field and hit CR? Aren't we doing that task as in the code snippet from post #16 above? e.g. isn't the station Posted at 2017-02-25 by @MaBecker
iPhone user would choose Settings -> Wifi -> connect to ESP AP Sure you can also use the PC and choose Wifi Setting and connect to ESP AP
No, "192.168.1.0" is the Wifi-Network your PC and ESP Station is connected created by your Wifi-Router. "192.168.4.0" is the Wifi-Network created by the ESP when AP is started So there are two different Wifi-Networks and you can only join to one at the time with a single Wifi card. Posted at 2017-02-26 by Robin Thank you for the detailed explanation.
I'm going to need to read up on networking as my understanding is a bit flawed. This also presents a snafu with my overall project idea, that the end user will need two connections and a bit more than a basic understanding, so the feasibility is now in question. Will be taking a break to do that research. Thanks for the exchange this evening, it has been quite enjoyable. Posted at 2017-02-26 by @MaBecker Yes - do some research, you will soon figure out that most of the IoT devices use this technic to get integrated into Wifi networks. So keep on going with your idea ! Posted at 2017-02-26 by @MaBecker #12 has a typo: res.write should be res.end
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-02-19 by Robin
Sun 2017.02.19
Attempting to connect to an ESP8266-12 using the browser. Always getting error "This site can’t be reached 192.168.1.71 refused to connect"
Windows 10 Home ver 10.0.14393 Build 14393 laptop running Chrome ver 56.0.2924.87 Firefox ver 51.0.1 WebIDE ver 0.65.9 Espruino ver 1v89
Have modified the @MaBecker example to add wrapper functions to quickly access status detail (see below)
It appears I am able to connect at the transport layer, just can't gain access at the application layer
I am able to determine the IP addr using gateway access 192.168.1.254 and locate the device detail beneath Home Network Devices (in this case I.P. is 192.168.1.71)
I am able to ping the device from the command line
I am able to connect through the WebIDE calling wrapper funtions in the left panel to display the status as a station i.e. wifi.getAPIP(), wifi.getAPDetails(), wifi.getIP(), wifi.getStatus()
Confirmed through network settings not using a proxy server
Viewed LMHOSTS file to make sure no garbage had been deposited there
Fiddler also confirms the issued request and captures the resultant error
Have even attempted adding this snippet in the left panel of the WebIDE
and typing 192.168.1.71 or 192.168.1.71:8080 in the browser address bar
Any ideas, code snippets, would be appreciated. Thank you Robin
Edit Sun 2017.02.19
Even in AP mode a request to 192.168.4.1 results in:
Beta Was this translation helpful? Give feedback.
All reactions