2015-05-24 21 views
5

sto cercando di trovare tutti i servizi di rete usando:Scoprite tutti i servizi della rete utilizzando Android NSD

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

ma è necessario definire service_type ad esempio:

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

così scopriremo tutti i servizi http utilizzando tcp, ma non troverà servizi https allo stesso tempo o qualsiasi altro tipo di servizi

come posso impostare tutto questo per trovare qualsiasi servizio utilizzando tcp?

Grazie in anticipo.

+0

Qualsiasi aggiornamento su questo? – user3316561

risposta

1

Sto usando

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

che mi dà un elenco di tutti i servizi disponibili sulla 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 
Problemi correlati