Created
February 6, 2018 09:37
-
-
Save baggior/f952b2884b1733b5248fb5f95234d63e to your computer and use it in GitHub Desktop.
MDNS query don't work?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WiFi.setHostname("espressif"); | |
MDNS.begin("espressif"); | |
delay(2000); | |
MDNS.addService("_osc","_udp",4500); | |
MDNS.addServiceTxt("_osc","_udp","does","it"); | |
delay(2000); | |
int n = MDNS.queryService("osc", "udp"); // Send out query for esp tcp services | |
if (n == 0) { | |
dbgstream->println("\tno services found"); | |
} else { | |
dbgstream->printf(" \t%d services found\n", n); | |
for (int i = 0; i < n; ++i) { | |
// Print details for each service found | |
dbgstream->printf("\t%d: %s (%s:%d)\n", | |
(i+1), MDNS.hostname(i).c_str(), MDNS.IP(i).toString().c_str(), MDNS.port(i)); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment