Recently I've been working on fixing bugs in an Android app, where one of its ma
in functions is to find network-connected printers and print to them. It was ori
ginally using the JmDNS library to do the network discovery of printers:
https://github.com/jmdns/jmdns
I've been working on this app for the past few weeks, and suddenly this past Mon
day, a weird issue started happing - The JmDNS library started to only give an i
pv6 network address for our test printer (previously, it had been giving an ipv4
address), and it seemed the ipv6 address it was giving was incorrect, as the ap
p couldn't ping and couldn't otherwise connect to the printer with that address.
I found that Google added a network service discovery API to the Android SDK sta
rting with SDK version 16:
https://developer.android.com/training/connect-devices-wirelessly/nsd
I updated the Android app to use the Android network service discovery API inste
ad of JmDNS, and I found the Android network service discovery returns the corre
ct network address for the printer (and is getting its ipv4 address). Now the a
pp can connect and print to the printer again.
I'm curious if anyone here has worked with network service discovery and has see
n anything weird like the issue I was having?
The office where I work did have a power outage last weekend, and I wonder if th
at may have affected anything on our network to cause the issue I was seeinig. B
ut it seems like it was purely a software issue, so I don't really know why I st
arted seeing that issue.
Also, I feel like the official Android network service discovery API would proba
bly be better to use than a 3rd-party library, but JmDNS is still in development
(the latest version is from August 2021), so I imagine there may be advantages
of using it. I'm wondering why choose something like JmDNS over the Android net
work service discovery API?
Nightfox
---
■ Synchronet ■ Digital Distortion: digitaldistortionbbs.com
|