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 includes the following:

Prerequisites

To enable your application to use the network service discovery functionality, follow these steps:

  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 the official site for Tizen applications 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;

Register local services

To register and deregister a local DNS-SD service, follow these steps:

  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();

Discover remote services

To discover remote DNS-SD services, follow these steps:

  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