0

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.

https://github.com/espressif/arduino-esp32/blob/a59eafbc9dfa3ce818c110f996eebf68d755be24/libraries/ESPmDNS/examples/mDNS-SD_Extended/mDNS-SD_Extended.ino

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!

3 Answers3

0

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.

José Simões
  • 606
  • 1
  • 5
  • 12
0

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.

hansmbakker
  • 1,108
  • 14
  • 29
-1

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)

Benvorth
  • 7,416
  • 8
  • 49
  • 70
  • The question was specifically about .NET nanoframework. Cristian shared that he already found the Arduino sample, so this answer is less relevant to the question. – hansmbakker Jan 01 '23 at 21:52