balthazar / react-native-zeroconf

:satellite: Discover Zeroconf services using react-native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposition (Android): resolve multiple IP addresses for DNSSD instead of a single IPv4

valentinmakov opened this issue · comments

Hi,

I noticed a couple of things that might be improved in the project.

First, I see that when using DNSSD mode on Android, services always resolve with a single IP address which might be not enough sometimes. After a brief investigation (I am no Java expert) I saw that in android/src/main/java/com/balthazargronon/RCTZeroconf/rx2dnssd/DnssdImpl.java file the IP addresses are retrieved with the help of a deprecated getInet4Address method (line 87). Replacing it with by getInetAddresses allows to get multiple addresses — IPv4 as well as IPv6. At least that what happens when running the app on iOS.

I could make a PR myself, but I can't find a way to push the code as I seem not to have a permission to do that.

The second thing I wanted to propose is to update the Readme, because it is not obvious now that a user can switch between default NSD and additional DNSSD modes. I took me a day to figure out that this option existed at all.