Skip to content

Instantly share code, notes, and snippets.

@baggior
Created February 6, 2018 09:37
Show Gist options
  • Save baggior/f952b2884b1733b5248fb5f95234d63e to your computer and use it in GitHub Desktop.
Save baggior/f952b2884b1733b5248fb5f95234d63e to your computer and use it in GitHub Desktop.
MDNS query don't work?
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