Add .NET NSD Guide 02/145602/2
authorEditor Lionbridge <TizenEditor.SEL@lionbridge.com>
Wed, 23 Aug 2017 05:37:43 +0000 (08:37 +0300)
committerEditor Lionbridge <TizenEditor.SEL@lionbridge.com>
Tue, 29 Aug 2017 05:52:07 +0000 (08:52 +0300)
Note that since the general structure of the .NET content is still open,
the new topic has not been added to any index files, and there is no
parent topic introducing the .NET guides.

Also, since there is no .NET AR content in git, all AR links lead
directly to TD.

PS2: Corrected the feature keys in the prerequisites section.

Change-Id: Ie15a9d19951541f0cfa76026e35407cb544e01ee

org.tizen.guides/html/dotnet/connectivity/nsd_cs.htm [new file with mode: 0644]

diff --git a/org.tizen.guides/html/dotnet/connectivity/nsd_cs.htm b/org.tizen.guides/html/dotnet/connectivity/nsd_cs.htm
new file mode 100644 (file)
index 0000000..b1bb07c
--- /dev/null
@@ -0,0 +1,151 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+       <meta http-equiv="X-UA-Compatible" content="IE=9" />
+       <link rel="stylesheet" type="text/css" href="../../css/styles.css" />
+       <link rel="stylesheet" type="text/css" href="../../css/snippet.css" />
+       <script type="text/javascript" src="../../scripts/snippet.js"></script>
+       <script type="text/javascript" src="../../scripts/jquery.util.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../../scripts/common.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../../scripts/core.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../../scripts/search.js" charset="utf-8"></script>
+
+       <title>Network Service Discovery</title>
+</head>
+
+<body onload="prettyPrint()" style="overflow: auto;">
+
+<div id="toc-navigation">
+
+       <div id="profile">
+               <p><img alt="Mobile C#" src="../../images/mobile_s_cs.png"/> <img alt="TV C#" src="../../images/tv_s_cs.png"/></p>
+       </div>
+
+       <div id="toc_border"><div id="toc">
+               <p class="toc-title">Dependencies</p>
+               <ul class="toc">
+                       <li>Tizen 4.0 and Higher for Mobile and TV</li>
+               </ul>
+
+               <p class="toc-title">Content</p>
+                       <ul class="toc">
+                               <li><a href="#prerequisites">Prerequisites</a></li>
+                               <li><a href="#registration">Registering Local Services</a></li>
+                               <li><a href="#discovery">Discovering Remote Services</a></li>
+                       </ul>
+               <p></p>
+
+               <p class="toc-title">Related Info</p>
+               <ul class="toc">
+                       <li><a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1Network_1_1Nsd.html">Tizen.Network.Nsd Namespace</a></li>
+               </ul>
+       </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+
+       <h1>Network Service Discovery</h1>
+<p>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).</p>
+<p>The main features of the Tizen.Network.Nsd namespace include:</p>
+
+<ul>
+       <li>Managing local services
+       <p>Registering a local service announces it over the network, allowing other devices to find and use it. You can create and <a href="#registration">register local services</a> through the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Network_1_1Nsd_1_1DnssdService.html">Tizen.Network.Nsd.DnssdService</a> and <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Network_1_1Nsd_1_1SsdpService.html">Tizen.Network.Nsd.SsdpService</a> classes, which both implement the <a href="https://developer.tizen.org/dev-guide/csapi/interfaceTizen_1_1Network_1_1Nsd_1_1INsdService.html">Tizen.Network.Nsd.INsdService</a> interface:
+       <ul>
+               <li>For the DNS-SD services, you can retrieve service details, such as name, type, port number and IP address, through related properties. You can also add a text record after registering the service, and set the key and value of the record. To remove a record, use its key.</li>
+               <li>For the SSDP services, you can retrieve service details, such as name, target, and URL.</li>
+       </ul>
+       <li>Discovering remote services
+       <p>You can <a href="#discovery">search for remote services</a> on the network through the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Network_1_1Nsd_1_1DnssdBrowser.html">Tizen.Network.Nsd.DnssdBrowser</a> and <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Network_1_1Nsd_1_1SsdpBrowser.html">Tizen.Network.Nsd.SsdpBrowser</a> classes, which both implement the <a href="https://developer.tizen.org/dev-guide/csapi/interfaceTizen_1_1Network_1_1Nsd_1_1 INsdBrowser.html">Tizen.Network.Nsd.INsdBrowser</a> interface. You can also  receive notifications when a service is found by registering an event handler for the <code>ServiceFound</code> event of the applicable class.</p></li>
+</ul>
+
+        <h2 id="prerequisites">Prerequisites</h2>
+        <p>To enable your application to use the network service discovery functionality:</p>
+        <ol>
+                <li>To use the Tizen.Network.Nds namespace, the application has to request permission by adding the following privilege to the  <code>tizen-manifest.xml</code> file:
+<pre class="prettyprint">
+&lt;privileges&gt;
+   &lt;privilege&gt;http://tizen.org/privilege/internet&lt;/privilege&gt;
+&lt;/privileges&gt;
+</pre>
+                </li>
+                <li>To make your application visible in the Tizen Store only for devices that support the DNS-SD and SSDP protocols, the application must specify the following features in the <code>tizen-manifest.xml</code> file:
+<pre class="prettyprint">
+&lt;feature name="http://tizen.org/feature/network.service_discovery.dnssd"/&gt;
+&lt;feature name="http://tizen.org/feature/network.service_discovery.ssdp"/&gt;
+</pre>
+                </li>
+                <li>To use the methods and properties of the Tizen.Network.Nsd namespace, include it in your application:
+<pre class="prettyprint">
+using Tizen.Network.Nsd;
+</pre>
+                </li>
+        </ol>
+
+<h2 id="registration">Registering Local Services</h2>
+<p>To register and deregister a local DNS-SD service:</p>
+       <ol>
+               <li>Register a service by creating a new instance of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Network_1_1Nsd_1_1DnssdService.html">Tizen.Network.Nsd.DnssdService</a> class and using its <code>RegisterService()</code> method:
+<pre class="prettyprint">
+/// Register service
+INsdService service = new DnssdService("_http._tcp");
+DnssdService dnssdService = (DnssdService)service;
+dnssdService.RegisterService();
+</pre>
+               </li>
+               <li>Deregister the service by using the <code>DeregisterService()</code> method.
+               <p>When the <code>Tizen.Network.Nsd.DnssdService</code> class instance is no longer needed, destroy it with the <code>Dispose()</code> method.</p>
+<pre class="prettyprint">
+/// Deregister service
+dnssdService.DeregisterService();
+dnssdService.Dispose();
+</pre>
+               </li>
+       </ol>
+
+<h2 id="discovery">Discovering Remote Services</h2>
+<p>To discover remote DNS-SD services:</p>
+       <ol>
+               <li>Start discovery by creating a new instance of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Network_1_1Nsd_1_1DnssdBrowser.html">Tizen.Network.Nsd.DnssdBrowser</a> class and using its <code>StartDiscovery()</code> method:
+<pre class="prettyprint">
+/// Start discovery
+INsdBrowser browser = new DnssdBrowser("_http._tcp");
+DnssdBrowser dnssdBrowser = (DnssdBrowser)browser;
+dnssdBrowser.StartDiscovery();
+</pre>
+               </li>
+               <li>When you have found the services you need, stop discovery by using the <code>StopDiscovery()</code> method.
+               <p>When the <code>Tizen.Network.Nsd.DnssdBrowser</code> class instance is no longer needed, destroy it with the <code>Dispose()</code> method.</p>
+<pre class="prettyprint">
+/// Stop discovery
+dnssdBrowser.StopDiscovery();
+dnssdBrowser.Dispose();
+</pre>
+               </li>
+       </ol>
+
+<script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>
+<script type="text/javascript" src="../../scripts/showhide.js"></script>
+</div></div></div>
+
+
+<a class="top sms" href="#"><img src="../../images/btn_top.gif" alt="Go to top"/></a>
+
+<div id="footer">
+<p class="footer">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br/>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
+</div>
+
+<script type="text/javascript">
+var _gaq = _gaq || [];
+_gaq.push(['_setAccount', 'UA-25976949-1']);
+_gaq.push(['_trackPageview']);
+(function() {
+var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+})();
+</script>
+
+</body>
+</html>