Reputation: 11
I'm just wondering if there are any means of service discovery built into the nanoframework?
I am mainly interested in mDNS or unicast DNS service discovery. Think Apple Bonjour/Avahi.
I noticed Espressif has some arduino examples around mDNS.
It would make sense as a separate deployment use case when you don't want to connect to a hub in the cloud but instead have the hub (MQTT server) running on the local network and need to discover it.
Many thanks!
Upvotes: 0
Views: 671
Reputation: 1234
Update 01-01-2023: Support for mDNS in .NET nanoframework was requested in https://github.com/nanoframework/Home/issues/912. In that discussion, https://github.com/karlredgate/mDNS-sharp was recommended as an alternative to having it built-in into .NET nanoframework. It is not clear whether people succeeded with that, though.
Upvotes: 0
Reputation: 701
Currently there is no support for mDNS in .NET nanoFramework. But that doesn't seem overcomplicated to add. Please raise an issue with the feature suggestion on our GitHub.
Upvotes: 0
Reputation: 7722
Welcome Cristian!
On an ESP32
you can include multicast DNS
and DNS-Service Discovery
like that:
#include <ESPmDNS.h>
...
if (MDNS.begin("esp32")) { // access this ESP32 via http://esp32 (eg in browser)
Serial.println("mDNS responder started");
}
...
// register a http-service in DNS-SD
if (mdns_service_add("esp32_website", "_http", "_tcp", 80, NULL, 0)) {
Serial.println("DNS-SD responder started");
}
mdns_service_txt_item_set("esp32_website", "_http._tcp", "version", "1.0");
In order to actually discover the ESP32
and it's services you need to make sure that the machine you are working on supports mDNS
and DNS-SD
.
Note: mDNS
just "resolves" the name of the ESP
to it's IP. You need to set-up a webserver on it to actually DO something (like provide the DNS-SD
-promised website or such)
Upvotes: -1