-->
Page 1 of 2

AP + Client and webserver, at same time?

PostPosted: Mon Mar 07, 2016 10:34 am
by jmaurin
Hi!
Is is possible to have AP + Client (station) at the same time, and create a WebServer listening on both?
I would like to create and AP for configuration and client for other function. On both, I'll have WebServer listening for connections and reply with some pages. I know there are some example of this, but the "AP" mode is enabled only if nothing is configured....I would like to keep AP ALWAYS, so any time I can connect and configure. Is possible? How do I do that using this library?
Tks!

Re: AP + Client and webserver, at same time?

PostPosted: Mon Mar 07, 2016 11:07 am
by martinayotte
You simply need to run in "WIFI_AP_STA = 3" mode, any TCP server, plain or Web, will listen to both IPs.
Code: Select allWiFi.mode(WIFI_AP_STA);

Re: AP + Client and webserver, at same time?

PostPosted: Sat May 06, 2017 7:29 pm
by treii28
How do you specify which connection you are sending data out of if both are active at once? I want to have an AP set up (all the time) only for changing configuration settings then use a station as needed to send telemetry back.

Re: AP + Client and webserver, at same time?

PostPosted: Sun May 07, 2017 8:28 am
by martinayotte
All this is managed automatically by networking layer. When station is connecting to your home AP router, it get an IP address from the router's DHCP as well as network mask and gateway IP address. When sending data, it is first sent to the gateway, which then forward it to the pointed server. Data will never coming out from ESP AP, unless it is a response to a client request. Again, this is all managed by network settings, AP and STA are on two separate network.