mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Fix LeamDNS examples (#5563)
* Fix LeamDNS examples * Fix Style check error * Another style fix
This commit is contained in:
parent
eb5d636f0d
commit
62b8ac6be7
@ -189,6 +189,7 @@ bool MDNSProbeResultCallback(MDNSResponder* p_pMDNSResponder,
|
||||
p_pMDNSResponder->setDynamicServiceTxtCallback(hMDNSService, MDNSDynamicServiceTxtCallback, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Change hostname, use '-' as divider between base name and index
|
||||
if (MDNSResponder::indexDomain(pcHostDomain, "-", 0)) {
|
||||
@ -198,7 +199,6 @@ bool MDNSProbeResultCallback(MDNSResponder* p_pMDNSResponder,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -241,8 +241,8 @@ void handleHTTPClient(WiFiClient& client) {
|
||||
if (req == "/") {
|
||||
IPAddress ip = WiFi.localIP();
|
||||
String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
|
||||
s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>Hello from ESP8266 at ";
|
||||
s += ipStr;
|
||||
s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>Hello from ";
|
||||
s += WiFi.hostname() + " at " + ipStr;
|
||||
// Simple addition of the current time
|
||||
s += "\r\nCurrent time is: ";
|
||||
s += getTimeString();
|
||||
|
@ -233,6 +233,7 @@ bool MDNSProbeResultCallback(MDNSResponder* p_pMDNSResponder,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Change hostname, use '-' as divider between base name and index
|
||||
if (MDNSResponder::indexDomain(pcHostDomain, "-", 0)) {
|
||||
@ -242,7 +243,6 @@ bool MDNSProbeResultCallback(MDNSResponder* p_pMDNSResponder,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -280,8 +280,8 @@ void handleHTTPClient(WiFiClient& client) {
|
||||
if (req == "/") {
|
||||
IPAddress ip = WiFi.localIP();
|
||||
String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
|
||||
s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>Hello from ESP8266 at ";
|
||||
s += ipStr;
|
||||
s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>Hello from ";
|
||||
s += WiFi.hostname() + " at " + ipStr;
|
||||
// Simple addition of the current time
|
||||
s += "<br/>Local HTTP services:<br/>";
|
||||
s += strHTTPServices;
|
||||
|
Loading…
x
Reference in New Issue
Block a user