osociety / network_tools

Networking Tools library which can help you discover open ports, devices on subnet and many other things.
https://pub.dev/packages/network_tools
BSD 3-Clause "New" or "Revised" License
45 stars 13 forks source link

mdns no result on arm architecture #72

Closed guyluz11 closed 1 year ago

guyluz11 commented 1 year ago

Testing mdns example on my arm architecture device I don't get any results, and there are no errors.

The same example return results in regular x64.

arm is also known as ARMv7 and armhf.

guyluz11 commented 1 year ago

After debugging I found that the crash is coming from the use of InternetAddress.lookup https://github.com/osociety/network_tools/blob/d73420a80acff56f1a788dd11c75d7bb8b401e04/network_tools/lib/src/mdns_scanner/mdns_scanner.dart#L95 and not from the mdns package.

It looks like it just does not find any result (IP for hostname) on my arm device.

Have opened an issue for that https://github.com/dart-lang/sdk/issues/50550 in the dart SDK repo.

git-elliot commented 1 year ago

Does it working after enabling mdns in your arm machine as told by dart sdk team? @guyluz11

guyluz11 commented 1 year ago

I'm not sure how to do that, will close this issue as I don't have the knowledge to understand the whole picture

guyluz11 commented 1 year ago

Found the solution

In case anyone else have the same issue as stated here

libnss-mdns was missing

sudo apt install libnss-mdns

and /etc/nsswitch.conf content needed to change to

hosts: files mymachines mdns4 [NOTFOUND=return] dns myhostname