ESP32 mDNS Query Returns No Results
DodaTech
Updated 2026-06-26
1 min read
In this tutorial, you'll learn about ESP32 mDNS Query Returns No Results. We cover key concepts, practical examples, and best practices.
The Problem
ESP32 queries mDNS for other devices on the network but finds nothing.
Quick Fix
Wrong
int n = MDNS.queryService("http", "tcp");
if (n == 0) Serial.println("No services found");
No services found (but other devices are online and advertising mDNS).
Right
MDNS.addService("http", "tcp", 80);
delay(2000);
int n = MDNS.queryService("http", "tcp");
Serial.printf("Found %d services\n", n);
for (int i = 0; i < n; i++) {
Serial.printf("%s:%d\n", MDNS.hostname(i).c_str(), MDNS.port(i));
}
Found 2 services
raspberrypi.local:80
server-room.local:3000
Prevention
Wait 2 seconds after starting mDNS before querying. Use exact service type and protocol. Verify target devices have mDNS enabled. Check that both devices are on the same VLAN/subnet.
DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro