andriydruk / RxDNSSD

Android version of mDNSResponder
Apache License 2.0
298 stars 75 forks source link

@abdur999 Please try Rx2DnssdBindable #205

Open abdur999 opened 3 years ago

abdur999 commented 3 years ago

@abdur999 Please try Rx2DnssdBindable

Originally posted by @andriydruk in https://github.com/andriydruk/RxDNSSD/issues/73#issuecomment-877177141

abdur999 commented 3 years ago

Same issue with the Rx2DnssdBindable version, I am using jdk 1.8 Is there any issue in my code ?

public void discover() { clear(); mRxDnssd = new Rx2DnssdBindable(this.mContext); Log.d("TAG", "Service Discover called from NsdHelper"); mDisposable = mRxDnssd.browse("_services._dns-sd._udp", "local.") .compose(mRxDnssd.resolve()) .compose(mRxDnssd.queryIPRecords()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(bonjourService -> { Log.d("TAG", bonjourService.toString()); if (bonjourService.isLost()) { Log.d(TAG, "Service discovery failed"); } else { Log.d(TAG, "Service discovery found"); serviceArr.add(bonjourService); handler.networkDiscover(serviceArr); } }, throwable -> Log.e("TAG", " discover error is", throwable));

}

public void clear()
{
    if (mDisposable != null) {
        mDisposable.dispose();
    }

    mDisposable = null;
}

Screenshot 2021-07-09 at 9 29 23 PM

andriydruk commented 3 years ago

You can't resolve services from _services._dns-sd._udp. You should just browse them, retrieve information about domains in your local network. And then start browsing in a particular domain. Please take a look at BonjourBrowser