http server switching network interface after it connected to a wifi #6262
Replies: 1 comment
-
Posted at 2019-07-10 by Unreality How to make a webserver that listen to both the access point network interface and station network interface? Posted at 2019-07-10 by @allObjects Sorry, you are a bit out of luck... The moment you tried to connect, it (Espruino wifi) picked up your home(?) WiFi access point and not the ESP12e's access point. The Web server then just uses this connection and is then listening on that connection... / network. ...after all it is not an Apache... Posted at 2019-07-10 by Robin Wed 2019.09.10 Hi @unreality, although I don't have a definitive answer to your situation, I too had a similar situation two years ago. This might provide some insight on what was tried (code ex) and what might be possible: 'STA or AP mode' What version of Espruino has been flashed? Following the above format and adhering to the guidelines at: would greatly assist us in assisting you. It is difficult to understand what else has been tried. Code page appears fine. Posting the output would make it easier for others to assist in providing some insight. . . . Has the use of 'Fiddler' been attempted to watch the connection attempts, and does that provide any additional detail? Posted at 2019-07-10 by Ollie I'm pretty sure ESP8266 can function simultaneously in both station and access point mode? Posted at 2019-07-10 by @MaBecker Hi, the idea behind this code is to integrate a device into an existing wlan by entering the connection data and then stop the access point if connected to that given wlan. Posted at 2019-07-10 by Robin Wed 2019.07.10
I agree @ollie, I just checked post #16 in first link (300549) from #4 above. The snippet of code to check that truth is in post #16 also. Posted at 2019-07-11 by Unreality
Espruino 2.0+ Posted at 2019-07-11 by @allObjects Sure, you can ran it as both, but you have to make sure the station connects to the desired wifi network / access point / SSID... I may be wrong, but that is how I understand getting a wifi connection and (dhcp driven) ip address. To get around (changing) ip address(es), a host name can be given so that browser url input can be book marked... Posted at 2019-07-11 by Ollie It is probably just a case of modifying the codebase you are using. Here is some code that runs ESP8266 as station and access point.
The server/page can be connected to on AP IP: 192.168.4.1 (port 8080) and the router allocated IP of 192.168.1.34 in this example. Both the AP IP and station IP are displayed in the page.
Perhaps you can modify from here to suit your needs. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-07-10 by Unreality
Hi all, I'm making an access portal for client to connect, using code from https://gist.githubusercontent.com/wilberforce/cc6025a535b8a4c7e2910d4ba7845f11/raw/1e119c8ce11e81b190dc368cf7bfe4f4567ba82d/gistfile1.txt
I tried to connect it using my iPhone, sometimes the captive portal doesn't prompt and I have to manually open iOS Chrome and fill in 192.168.4.1 to load the portal page
moreover, when I fill in the wifi info for the ESP12e, and that the ESP-12e connected to the local wifi network successfully, obtained an IP of 192.168.8.12, then something strange happened: the ESP-12e webserver no longer listen web request from 192.168.4.1, and it now only listen to 192.168.8.12, which means, my iPhone failed to have any new interaction with ESP-12e thr 192.168.4.1, which made the captive portal unresponsive, and therefore the captive portal failed to notify my iPhone that it has obtained an IP of 192.168.8.12 from the local network
as a result, I have no way to figure the ESP-12e's wifi IP address from its captive portal page :( this is bad
how to ensure the web server listen to both wifi staton (192.168.8.12) and AP (192.168.4.1) ? thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions