Network Service Discovery

You can use 2 different protocols to perform network service discoveries to announce local services and search for remote services on a network: DNS-SD (DNS Service Discovery) and SSDP (Simple Service Discovery Protocol).

The main features of the Tizen.Network.Nsd namespace include:

Prerequisites

To enable your application to use the network service discovery functionality:

  1. To use the Tizen.Network.Nsd namespace, the application has to request permission by adding the following privilege to the tizen-manifest.xml file:

    XML
    Copy
    <privileges> <privilege>http://tizen.org/privilege/internet</privilege> </privileges>
  2. To make your application visible in Tizen Store only for devices that support the DNS-SD and SSDP protocols, the application must specify the following features in the tizen-manifest.xml file:

    XML
    Copy
    <feature name="http://tizen.org/feature/network.service_discovery.dnssd"/> <feature name="http://tizen.org/feature/network.service_discovery.ssdp"/>
  3. To use the methods and properties of the Tizen.Network.Nsd namespace, include it in your application:

    C#
    Copy
    using Tizen.Network.Nsd;

Registering Local Services

To register and deregister a local DNS-SD service:

  1. Register a service by creating a new instance of the Tizen.Network.Nsd.DnssdService class and using its RegisterService() method:

    C#
    Copy
    /// Register service INsdService service = new DnssdService("_http._tcp"); DnssdService dnssdService = (DnssdService)service; dnssdService.RegisterService();
  2. Deregister the service by using the DeregisterService() method.

    When the Tizen.Network.Nsd.DnssdService class instance is no longer needed, destroy it with the Dispose() method.

    C#
    Copy
    /// Deregister service dnssdService.DeregisterService(); dnssdService.Dispose();

Discovering Remote Services

To discover remote DNS-SD services:

  1. Start discovery by creating a new instance of the Tizen.Network.Nsd.DnssdBrowser class and using its StartDiscovery() method:

    C#
    Copy
    /// Start discovery INsdBrowser browser = new DnssdBrowser("_http._tcp"); DnssdBrowser dnssdBrowser = (DnssdBrowser)browser; dnssdBrowser.StartDiscovery();
  2. When you have found the services you need, stop discovery by using the StopDiscovery() method.

    When the Tizen.Network.Nsd.DnssdBrowser class instance is no longer needed, destroy it with the Dispose() method.

    C#
    Copy
    /// Stop discovery dnssdBrowser.StopDiscovery(); dnssdBrowser.Dispose();
  • Dependencies
    • Tizen 4.0 and Higher
Connection Management
Next Wi-Fi
Submit your feedback to GitHub