I'm using Arduino IDE 1.6 nightly with Generic ESP8266 Board.

Why this code runs in mesh mode instead of simply connecting to my wifi? My goal is to test out MDNS, but so far I found this:

To my understanding such code should just connect to my wifi and I would then be able to navigate to http://esp8266-webupdate.local/update, am I missing something?

output (note STA+AP)

Booting Sketch...
Connected, IP address:
Mode: STA+AP
PHY mode: N
Channel: 10
AP id: 0
Status: 5
Auto connect: 1


#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266HTTPUpdateServer.h>

const char* host = "esp8266-webupdate";
const char* ssid = "myhomeap";
const char* password = "blabla";

ESP8266WebServer httpServer(80);
ESP8266HTTPUpdateServer httpUpdater;

void setup(void){

  Serial.println("Booting Sketch...");
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {

  Serial.print("Connected, IP address: ");


  MDNS.addService("http", "tcp", 80);
  Serial.printf("HTTPUpdateServer ready! Open http://%s.local/update in your browser\n", host);

void loop(void){
  • 1
    because of the WiFi.mode(WIFI_AP_STA); line?
    – Juraj
    Jun 9 '18 at 4:42
  • the mdns propagation is not instant. wait some time
    – Juraj
    Jun 9 '18 at 4:44
  • thanks, do you happen to know if is it necessary to go into this mode for mdns to work? this code was taken from examples
    – John Smith
    Jun 9 '18 at 5:11
  • mdns works as expected in STA mode. only sometimes it takes time until the mdns name appears in IDE Port menu. (I use Eclipse and there I can type the address if it is still not found by mdns service)
    – Juraj
    Jun 9 '18 at 5:15
  • 1
    STA only yes. and it doesn't need mdns. you can use the IP address. for Upload from IDE use ArduinoOTA library
    – Juraj
    Jun 9 '18 at 6:35

It goes into STA+AP mode because your code is telling it to do that.

If you want it to just go into STA mode then your line:


should be


  • thanks, the code was taken from examples, do you know if going into AP mode is necessary for MDNS to work at all?
    – John Smith
    Jun 9 '18 at 5:10
  • In theory MDNS should work in any mode, but of course would only be visible on networks that the ESP was actually connected to. There are several issues filed on the MDNS code that show other people having trouble with STA+AP mode. There was a fix checked in but it's not clear that it really resolved the problem. So you're not the only one with problems with it; I wouldn't expect it to definitely work, unfortunately.
    – romkey
    Jun 9 '18 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.