All Projects → andriydruk → Rxdnssd

andriydruk / Rxdnssd

Licence: apache-2.0
Android version of mDNSResponder

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Rxdnssd

Yii2
Yii 2: The Fast, Secure and Professional PHP Framework
Stars: ✭ 13,852 (+6591.79%)
Mutual labels:  hacktoberfest
Weblate
Web based localization tool with tight version control integration.
Stars: ✭ 2,719 (+1213.53%)
Mutual labels:  hacktoberfest
Umbracodocs
The official Umbraco Documentation
Stars: ✭ 207 (+0%)
Mutual labels:  hacktoberfest
Openwisp Radius
Administration web interface and REST API for freeradius 3 build in django & python. Supports captive portal authentication, WPA Enerprise (802.1x), freeradius rlm_rest, social login, Hotspot 2.0 / 802.11u, importing users from CSV, registration of new users and more.
Stars: ✭ 206 (-0.48%)
Mutual labels:  hacktoberfest
Wharf
Web UI for Dokku
Stars: ✭ 206 (-0.48%)
Mutual labels:  hacktoberfest
Pdns
PowerDNS Authoritative, PowerDNS Recursor, dnsdist
Stars: ✭ 2,575 (+1143.96%)
Mutual labels:  hacktoberfest
Shields
Concise, consistent, and legible badges in SVG and raster format
Stars: ✭ 15,716 (+7492.27%)
Mutual labels:  hacktoberfest
React Navigation.github.io
Home of the documentation and other miscellanea
Stars: ✭ 207 (+0%)
Mutual labels:  hacktoberfest
Vulny Code Static Analysis
Python script to detect vulnerabilities inside PHP source code using static analysis, based on regex
Stars: ✭ 207 (+0%)
Mutual labels:  hacktoberfest
Org Cliplink
Insert org-mode links from clipboard
Stars: ✭ 207 (+0%)
Mutual labels:  hacktoberfest
Bilberry Hugo Theme
Premium theme for the hugo site builder. DEMO:
Stars: ✭ 205 (-0.97%)
Mutual labels:  hacktoberfest
Doukutsu Rs
4fun open-source Cave Story reimplementation written in Rust
Stars: ✭ 206 (-0.48%)
Mutual labels:  hacktoberfest
Wireflow
Wireflow - user flow chart real-time collaborative tool
Stars: ✭ 2,788 (+1246.86%)
Mutual labels:  hacktoberfest
Liquibase Hibernate
Liquibase Hibernate Integration
Stars: ✭ 205 (-0.97%)
Mutual labels:  hacktoberfest
Links Estudo
Links interessantes sobre tudo abordado no curso
Stars: ✭ 204 (-1.45%)
Mutual labels:  hacktoberfest
Tauri
Build smaller, faster, and more secure desktop applications with a web frontend.
Stars: ✭ 25,383 (+12162.32%)
Mutual labels:  hacktoberfest
Ru Test Assignments
Тестовые задания для самостоятельного выполнения от разных it компаний
Stars: ✭ 2,926 (+1313.53%)
Mutual labels:  hacktoberfest
Home
A configurable and eXtensible Xml serializer for .NET.
Stars: ✭ 208 (+0.48%)
Mutual labels:  hacktoberfest
Zio Todo Backend
Todo-Backend (https://www.todobackend.com/) implementation using ZIO, http4s and circe
Stars: ✭ 207 (+0%)
Mutual labels:  hacktoberfest
Preserver
Preserver is desktop notes organiser built on electron, angular2, pouchDB
Stars: ✭ 207 (+0%)
Mutual labels:  hacktoberfest

Android mDNSResponder Circle CI Download Download Download

Why I created this library?

My explanation about why jmDNS, Android NSD Services and Google Nearby API are not good enough, and why I maintain this library.

Hierarchy

There are two version of mDNSReposder.

Bindable version:

                                   +--------------------+       +--------------------+
                                   |      RxDNSSD       |       |       Rx2DNSSD     |
                                   +--------------------+       +--------------------+
                                           |                            |
                                           |   +--------------------+   |
                                            -->| Android Java DNSSD |<--
                                               +--------------------+
                                               |  Apple Java DNSSD  |
                 +------------------+          +--------------------+
                 |    daemon.c      |<-------->|     mDNS Client    |
                 +------------------+          +--------------------+
                 |    mDNS Core     |
                 +------------------+
                 | Platform Support |
                 +------------------+
                    System process                Your Android app

Embedded version:

                     +--------------------+       +--------------------+
                     |      RxDNSSD       |       |       Rx2DNSSD     |
                     +--------------------+       +--------------------+
                                |                            |
                                |   +--------------------+   |
                                 -->| Android Java DNSSD |<--
                                    +--------------------+
                                    |   Apple Java DNSSD |    
                                    +--------------------+
                                    |    mDNS Client     |
                                    +--------------------+
                                    | Embedded mDNS Core |
                                    +--------------------+
                                    | Platform Support   |
                                    +--------------------+
                                      Your Android app

Binaries

My dnssd library:

compile 'com.github.andriydruk:dnssd:0.9.13'

My rxdnssd library:

compile 'com.github.andriydruk:rxdnssd:0.9.13'

My rx2dnssd library:

compile 'com.github.andriydruk:rx2dnssd:0.9.13'
  • It's built with Andorid NDK r18b for all platforms (1.7 MB). If you prefer another NDK version or subset of platforms, please build it from source with command:
./gradlew clean build

How to use

DNSSD

Dnssd library provides two implementations of DNSSD interface:

DNSSDBindable is an implementation of DNSSD with system's daemon. Use it for Android project with min API higher than 4.1 for an economy of battery consumption (Also some Samsung devices can don't work with this implementation).

DNSSD dnssd = new DNSSDBindable(context); 

DNSSDEmbedded is an implementation of RxDnssd with embedded DNS-SD core. Can be used for any Android device with min API higher than Android 4.0.

DNSSD dnssd = new DNSSDEmbedded(); 
Register service
try {
	registerService = dnssd.register("service_name", "_rxdnssd._tcp", 123,  
   		new RegisterListener() {

			@Override
			public void serviceRegistered(DNSSDRegistration registration, int flags, 
				String serviceName, String regType, String domain) {
				Log.i("TAG", "Register successfully ");
			}

			@Override
         	public void operationFailed(DNSSDService service, int errorCode) {
				Log.e("TAG", "error " + errorCode);
        	}
   		});
} catch (DNSSDException e) {
	Log.e("TAG", "error", e);
}
Browse services example
try {
	browseService = dnssd.browse("_rxdnssd._tcp", new BrowseListener() {
                
 		@Override
		public void serviceFound(DNSSDService browser, int flags, int ifIndex, 
			final String serviceName, String regType, String domain) {
			Log.i("TAG", "Found " + serviceName);
		}

		@Override
		public void serviceLost(DNSSDService browser, int flags, int ifIndex, 
			String serviceName, String regType, String domain) {
			Log.i("TAG", "Lost " + serviceName);
		}

		@Override
		public void operationFailed(DNSSDService service, int errorCode) {
			Log.e("TAG", "error: " + errorCode);
		}        
	});
} catch (DNSSDException e) {
	Log.e("TAG", "error", e);
}

You can find more samples in app inside this repository.

RxDNSSD

  • RxDnssdBindable
RxDnssd rxdnssd = new RxDnssdBindable(context); 
  • RxDnssdEmbedded
RxDnssd rxdnssd = new RxDnssdEmbedded(); 
Register service
BonjourService bs = new BonjourService.Builder(0, 0, Build.DEVICE, "_rxdnssd._tcp", null).port(123).build();
Subscription subscription = rxdnssd.register(bonjourService)
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(service -> {
      		updateUi();
      }, throwable -> {
        	Log.e("DNSSD", "Error: ", throwable);
      });
Browse services example
Subscription subscription = rxDnssd.browse("_http._tcp", "local.")
	.compose(rxDnssd.resolve())
    .compose(rxDnssd.queryRecords())
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(new Action1<BonjourService>() {
    	@Override
        public void call(BonjourService bonjourService) {
        	Log.d("TAG", bonjourService.toString());
        }
    }, new Action1<Throwable>() {
        @Override
        public void call(Throwable throwable) {
        	Log.e("TAG", "error", throwable);
        }
	});

Rx2DNSSD

  • Rx2DnssdBindable
Rx2Dnssd rxdnssd = new Rx2DnssdBindable(context); 
  • Rx2DnssdEmbedded
Rx2Dnssd rxdnssd = new Rx2DnssdEmbedded(); 
Register service
BonjourService bs = new BonjourService.Builder(0, 0, Build.DEVICE, "_rxdnssd._tcp", null).port(123).build();
registerDisposable = rxDnssd.register(bs)
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(bonjourService -> {
            Log.i("TAG", "Register successfully " + bonjourService.toString());
        }, throwable -> {
            Log.e("TAG", "error", throwable);
        });
Browse services example
browseDisposable = rxDnssd.browse("_http._tcp", "local.")
        .compose(rxDnssd.resolve())
        .compose(rxDnssd.queryRecords())
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(bonjourService -> {
            Log.d("TAG", bonjourService.toString());
            if (bonjourService.isLost()) {
                mServiceAdapter.remove(bonjourService);
            } else {
                mServiceAdapter.add(bonjourService);
            }
        }, throwable -> Log.e("TAG", "error", throwable));

License

Copyright (C) 2016 Andriy Druk

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].