esp32 mDNS
Posted: Sun Mar 24, 2019 11:02 am
hi
I can access the server through the IP
But I can not access through local
Is there a solution to this problem I'm using Windows 10
//////////////////////////////////////////////////
#include<WiFi.h>
#include<ESPmDNS.h>
char ssid[] = "xxxxxxxx";
char pass[] = "xxxxxxxx";
WiFiServer server(80);
void setup() {
Serial.begin(115200);
WiFi.disconnect();
Serial.println();
Serial.println();
Serial.println("Coneecting to: ");
Serial.println(ssid);
WiFi.begin(ssid,pass);
while (WiFi.status() !=WL_CONNECTED){
delay (500);
Serial.println(".");}
Serial.println("");
Serial.println("WiFi is connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
while(!MDNS.begin("esp32")){
Serial.println("Error setting up MDNS responder!");
delay (1);
}
Serial.println("mDNS started");
server.begin();
Serial.println("Web server started");
}
void loop() {
WiFiClient client = server.available();
if(!client){return;}
while(!client.available()){delay(1);}
Serial.println(client.readString());
client.stop();
}
/////////////////////////////////
Is there any error in the code
I can access the server through the IP
But I can not access through local
Is there a solution to this problem I'm using Windows 10
//////////////////////////////////////////////////
#include<WiFi.h>
#include<ESPmDNS.h>
char ssid[] = "xxxxxxxx";
char pass[] = "xxxxxxxx";
WiFiServer server(80);
void setup() {
Serial.begin(115200);
WiFi.disconnect();
Serial.println();
Serial.println();
Serial.println("Coneecting to: ");
Serial.println(ssid);
WiFi.begin(ssid,pass);
while (WiFi.status() !=WL_CONNECTED){
delay (500);
Serial.println(".");}
Serial.println("");
Serial.println("WiFi is connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
while(!MDNS.begin("esp32")){
Serial.println("Error setting up MDNS responder!");
delay (1);
}
Serial.println("mDNS started");
server.begin();
Serial.println("Web server started");
}
void loop() {
WiFiClient client = server.available();
if(!client){return;}
while(!client.available()){delay(1);}
Serial.println(client.readString());
client.stop();
}
/////////////////////////////////
Is there any error in the code