You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 3, 2024. It is now read-only.
If android device has multiple interfaces along with WIFI binding to particular address explicitly results in 0.0.0.0 address if WIFI is disabled or in actual WIFI address if WIFI is enabled broadcasted in mDNS service record. Thus value passed to .address method is completely ignored.
Result would be either 0.0.0.0 or ip of WIFI network.
This happens because of this method of SupportUtils class:
/** * Returns the JmDNS shared among all subscribers for Bonjour events, creating it if necessary. * * @param context Context used to access the WifiManager for the device's IP address with which JmDNS is initialized * @return The JmDNS instance * @throws IOException In case the device's address can't be resolved */@OverridepublicJmDNSgetManager(Contextcontext) throwsIOException {
synchronized (jmdnsLock) {
if (jmdnsInstance == null || !isAvailable()) {
WifiManagerwifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
InetAddressinetAddress = getInetAddress(wifiManager);
jmdnsInstance = JmDNS.create(inetAddress, inetAddress.toString());
jmdnsSubscriberCount.set(0);
}
returnjmdnsInstance;
}
}
which gets context passed in SupportBonjourBroadcast class' start method:
finalJmDNSjmdns = utils.getManager(context);
To override this behaviour I wrote another implementation of BonjourBroadcast abstract class which is almost the same except it uses differen method in support utils. This is its kotlin code:
If android device has multiple interfaces along with WIFI binding to particular address explicitly results in 0.0.0.0 address if WIFI is disabled or in actual WIFI address if WIFI is enabled broadcasted in mDNS service record. Thus value passed to
.address
method is completely ignored.Example code in kotlin:
Result would be either
0.0.0.0
or ip of WIFI network.This happens because of this method of
SupportUtils
class:which gets context passed in
SupportBonjourBroadcast
class'start
method:To override this behaviour I wrote another implementation of BonjourBroadcast abstract class which is almost the same except it uses differen method in support utils. This is its kotlin code:
I am not proposing this exact fix but I think something should be done with the issue of binding to the address specified by corresponding method.
The text was updated successfully, but these errors were encountered: