• Android JmDNS vs. Android Network Service Discovery

    From Nightfox@VERT/DIGDIST to All on Thu Jun 9 09:42:32 2022
    Recently I've been working on fixing bugs in an Android app, where one of its main functions is to find network-connected printers and print to them. It was originally 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 Monday, a weird issue started happing - The JmDNS library started to only give an ipv6 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 app 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 starting 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 instead of JmDNS, and I found the Android network service discovery returns the correct network address for the printer (and is getting its ipv4 address). Now the app can connect and print to the printer again.ããI'm curious if anyone here has worked with network service discovery and has seen anything weird like the issue I was having?ããThe office where I work did have a power outage last weekend, and I wonder if that may have affected anything on our network to cause the issue I was seeinig. But it seems like it was purely a software issue, so I don't really know why I started seeing that issue.ããAlso, I feel like the official Android network service discovery API would probably 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 network service discovery API?ããNightfoxãã---ã þ Synchronet þ Digital Distortion: digitaldistortionbbs.comã
  • From Digital Man@VERT to Nightfox on Thu Jun 9 10:57:10 2022
    Re: Android JmDNS vs. Android Network Service Discoveryã By: Nightfox to All on Thu Jun 09 2022 09:42 amãã > Recently I've been working on fixing bugs in an Android app, where one ofã > its main functions is to find network-connected printers and print to them.ã > It was originally 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ã > Monday, a weird issue started happing - The JmDNS library started to onlyã > give an ipv6 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 app 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ã > starting 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ã > instead of JmDNS, and I found the Android network service discovery returnsã > the correct network address for the printer (and is getting its ipv4ã > address). Now the app can connect and print to the printer again.ã >ã > I'm curious if anyone here has worked with network service discovery and hasã > seen anything weird like the issue I was having?ã >ã > The office where I work did have a power outage last weekend, and I wonderã > if that may have affected anything on our network to cause the issue I wasã > seeinig. But it seems like it was purely a software issue, so I don't reallyã > know why I started seeing that issue.ã >ã > Also, I feel like the official Android network service discovery API wouldã > probably 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 network service discovery API?ããThe underlying system function is probably getaddrinfo (https://linux.die.net/man/3/getaddrinfo) which provides the caller control over the inclusion/exclusion of address families (e.g. IPv4 or IPv6). I'm not familiar with JmDNS or the Android network service discovery API, but look for similar control over the address "families" that may be returned by such discovery functions.ã-- ã digital man (rob)ããRush quote #8:ãOne likes to believe in the freedom of music...ãNorco, CA WX: 77.2øF, 63.0% humidity, 2 mph E wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From Nightfox@VERT/DIGDIST to Digital Man on Thu Jun 9 12:02:51 2022
    Re: Android JmDNS vs. Android Network Service Discoveryã By: Digital Man to Nightfox on Thu Jun 09 2022 10:57 amãã DM> The underlying system function is probably getaddrinfoã DM> (https://linux.die.net/man/3/getaddrinfo) which provides the callerã DM> control over the inclusion/exclusion of address families (e.g. IPv4 orã DM> IPv6). I'm not familiar with JmDNS or the Android network serviceã DM> discovery API, but look for similar control over the address "families"ã DM> that may be returned by such discovery functions.ããI suspected there may be some underlying function to control which type of network addresses are returned. When using the JmDNS library, there was nothing specifying to use either ipv4 or ipv6 addresses (and it was getting an ipv4 address previously). I hadn't changed anything in the app to specify which type of address to receive though; for some reason it seemed to change on its own. It had started working again with the JmDNS library, but when I ran through some specific steps, it triggered something to only get an ipv6 address (no change in the code).ããNightfoxãã---ã þ Synchronet þ Digital Distortion: digitaldistortionbbs.comã
  • From Digital Man@VERT to Nightfox on Thu Jun 9 14:16:01 2022
    Re: Android JmDNS vs. Android Network Service Discoveryã By: Nightfox to Digital Man on Thu Jun 09 2022 12:02 pmãã > Re: Android JmDNS vs. Android Network Service Discoveryã > By: Digital Man to Nightfox on Thu Jun 09 2022 10:57 amã >ã > DM> The underlying system function is probably getaddrinfoã > DM> (https://linux.die.net/man/3/getaddrinfo) which provides the callerã > DM> control over the inclusion/exclusion of address families (e.g. IPv4 orã > DM> IPv6). I'm not familiar with JmDNS or the Android network serviceã > DM> discovery API, but look for similar control over the address "families"ã > DM> that may be returned by such discovery functions.ã >ã > I suspected there may be some underlying function to control which type ofã > network addresses are returned. When using the JmDNS library, there wasã > nothing specifying to use either ipv4 or ipv6 addresses (and it was gettingã > an ipv4 address previously). I hadn't changed anything in the app toã > specify which type of address to receive though; for some reason it seemedã > to change on its own. It had started working again with the JmDNS library,ã > but when I ran through some specific steps, it triggered something to onlyã > get an ipv6 address (no change in the code).ããCould the change just simply be on the DNS records for the address your resolving? Are you seeing this same change in behavior for all addresses being resolved or just some?ã-- ã digital man (rob)ããSynchronet "Real Fact" #23:ãThe third ever Synchronet BBS was The Beast's Domain (sysop: King Drafus)ãNorco, CA WX: 89.0øF, 43.0% humidity, 15 mph S wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From Nightfox@VERT/DIGDIST to Digital Man on Thu Jun 9 14:59:55 2022
    Re: Android JmDNS vs. Android Network Service Discoveryã By: Digital Man to Nightfox on Thu Jun 09 2022 02:16 pmãã >> I suspected there may be some underlying function to control whichã >> type of network addresses are returned. When using the JmDNS library,ã >> there was nothing specifying to use either ipv4 or ipv6 addresses (andã >> it was getting an ipv4 address previously). I hadn't changed anythingã >> in the app to specify which type of address to receive though; forã >> some reason it seemed to change on its own. It had started workingã >> again with the JmDNS library, but when I ran through some specificã >> steps, it triggered something to only get an ipv6 address (no changeã >> in the code). ãã DM> Could the change just simply be on the DNS records for the address yourã DM> resolving? Are you seeing this same change in behavior for all addressesã DM> being resolved or just some?ããI'd only been testing it with the one printer (which was the only printer that was coming up), so I'm not really sure.ããNightfoxãã---ã þ Synchronet þ Digital Distortion: digitaldistortionbbs.comã
  • From Nightfox@VERT/DIGDIST to Digital Man on Thu Jun 9 15:28:58 2022
    Re: Android JmDNS vs. Android Network Service Discoveryã By: Nightfox to Digital Man on Thu Jun 09 2022 02:59 pmãã DM>> Could the change just simply be on the DNS records for the addressã DM>> your resolving? Are you seeing this same change in behavior for allã DM>> addresses being resolved or just some?ãã Ni> I'd only been testing it with the one printer (which was the only printerã Ni> that was coming up), so I'm not really sure. ããOther apps on the device were able to get the correct (and ipv4) address of the printer, which made me think it may have been something going on with the jmDNS library.ããNightfoxãã---ã þ Synchronet þ Digital Distortion: digitaldistortionbbs.comã
  • From Digital Man@VERT to Nightfox on Thu Jun 9 16:37:50 2022
    Re: Android JmDNS vs. Android Network Service Discoveryã By: Nightfox to Digital Man on Thu Jun 09 2022 03:28 pmãã > Re: Android JmDNS vs. Android Network Service Discoveryã > By: Nightfox to Digital Man on Thu Jun 09 2022 02:59 pmã >ã > DM>> Could the change just simply be on the DNS records for the addressã > DM>> your resolving? Are you seeing this same change in behavior for allã > DM>> addresses being resolved or just some?ã >ã > Ni> I'd only been testing it with the one printer (which was the onlyã > Ni> printer that was coming up), so I'm not really sure.ã >ã > Other apps on the device were able to get the correct (and ipv4) address ofã > the printer, which made me think it may have been something going on withã > the jmDNS library.ããI just realized this is multicast DNS (Bonjour) you're dealing with. Very different animal from what I was originally interpretting your problem/solution to be.ããNetwork packet captures with the appropriate disectors/parsers might help illuminate what's going on.ã-- ã digital man (rob)ããSling Blade quote #6:ãKarl: he should've had a chance to grow up. He would had fun some time.ãNorco, CA WX: 86.1øF, 47.0% humidity, 8 mph SSE wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã