Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Discover all services in the network using android NSD

Tags:

android

nsd

I´m trying to find all services in the network using:

mNsdManager.discoverServices(
            SERVICE_TYPE, NsdManager.PROTOCOL_DNS_SD, mDiscoveryListener);

but you have to define SERVICE_TYPE for example:

public static final String SERVICE_TYPE = "_http._tcp.";

so it will discover all http services using tcp, but it wouldn´t find https services at the same time or any other kind of services

how can i set all this in order to find any service using tcp?

Thank you in advance.

like image 243
user1576396 Avatar asked May 24 '15 08:05

user1576396


People also ask

What is NSD in Android?

Network service discovery (NSD) gives your app access to services that other devices provide on a local network. Devices that support NSD include printers, webcams, HTTPS servers, and other mobile devices.

What is service discovery protocol explain it?

The Service Discovery Protocol (SDP) is used by a client device to find out about the services it can use on a server device. An SDP server maintains a database of services; this can be preconfigured (static), or can be built up dynamically as services register with the database system.


Video Answer


1 Answers

I am using

private static final String SERVICE_TYPE = "_services._dns-sd._udp";

which gives me a list of all available services on the LAN:

D/MHC-NSD: Service discovery found: name: _workstation, type: _tcp.local., host: null, port: 0
D/MHC-NSD: Service discovery found: name: _UnoWiFi, type: _tcp.local., host: null, port: 0
D/MHC-NSD: Service discovery found: name: _udisks-ssh, type: _tcp.local., host: null, port: 0
D/MHC-NSD: Service discovery found: name: _airplay, type: _tcp.local., host: null, port: 0
D/MHC-NSD: Service discovery found: name: _raop, type: _tcp.local., host: null, port: 0
D/MHC-NSD: Service discovery found: name: _xbmc-events, type: _udp.local., host: null, port: 0
D/MHC-NSD: Service discovery found: name: _xbmc-jsonrpc, type: _tcp.local., host: null, port: 0
D/MHC-NSD: Service discovery found: name: _xbmc-jsonrpc-h, type: _tcp.local., host: null, port: 0
D/MHC-NSD: Service discovery found: name: _http, type: _tcp.local., host: null, port: 0
D/MHC-NSD: Service discovery found: name: _sftp-ssh, type: _tcp.local., host: null, port: 0
D/MHC-NSD: Service discovery found: name: _ssh, type: _tcp.local., host: null, port: 0
D/MHC-NSD: Service discovery found: name: _arduino, type: _tcp.local., host: null, port: 0
like image 67
BeeGee1962 Avatar answered Oct 17 '22 23:10

BeeGee1962