sebastianhaberey / nsd

Flutter Network Service Discovery (NSD) Plugin
61 stars 29 forks source link

mDNS Service registered with nsd not resolving correctly. #43

Open justbendev opened 1 year ago

justbendev commented 1 year ago

Description

Hello :wave:


I hope you guys are doing well :smile:

I'am oppening an issue since i couldn't find a solution myself and i'am pretty sure it's not Client or Firewall related. Basically i'am publishing a service with nsd but can't resolve the .local domain from client computer. I'am able to see the service with mdns-scan (linux) but can't resolve with a ping command.

I tried with and without manually setting addresses list in nsd but i had the same result.

I can resolve my ESP8266 & ESP32 MDNS Services fine , only mdns services registered with nsd on my Android Tablet have issues resolving on any computer on my lan.

With manual addresses list

void example() async {
  for (var interface in await NetworkInterface.list()) {
        if (interface.name == "wlan0") {
          for (var addr in interface.addresses) {
            if (addr.type.name == "IPv4" && addr.isLoopback == false) {
              print(addr.address);
              register(
                Service(
                    name: '4022d8feb94cdomotika',
                    type: '_servicename._tcp',
                    addresses: [addr],
                    port: 36080),
              );
            }
          }
        }
}

Without manual addresses list

void example() {
    register(
      Service(
          name: '4022d8feb94cdomotika',
          type: '_servicename._tcp',
          port: 36080
      ),
    );
}

Thanks , and have a nice day :wave:

Scenario

Use the plugin in my own application via Flutter dependency

Platform

Android

justbendev commented 1 year ago

Found the issue after some debugging. By default nsd do not use "name + .local" as hostname, Android.local have been used by default. it can be set with the hostname arg.

Have a nice day.

justbendev commented 1 year ago

Setting the host param creates a runtime Exception : NsdError (NsdError (message: "register: null", cause: internalError))