Namespace Tizen.Network.Nsd
The Tizen.Network.Nsd namespace provides classes to manage the network service discovery protocols.
Overview
The Nsd API handles DNS-SD (DNS Service Discovery) protocol. It allows applications to announce local services and search for remote services on a network.
Registering a Service on Network
// Create and register a service
DnssdService service = new DnssdService("_http._tcp");
service.Name = "TestService";
service.Port = "1234";
service.RegisterService();
// Optional: Add TXT records
service.AddTXTRecord("version", "1.0");
Discovering Services on Network
// Create browser and start discovery
DnssdBrowser browser = new DnssdBrowser("_http._tcp");
browser.ServiceFound += (s, e) =>
{
if (e.State == DnssdServiceState.Available)
{
// Handle the discovered service
}
};
browser.StartDiscovery();
Cleaning Up on Application Exit
// Stop service discovery
browser.StopDiscovery();
// Deregister service and dispose resources
service.DeregisterService();
service.Dispose();
Related Features
To use DNS-SD, declare the following feature requirements in the config file: http://tizen.org/feature/network.service_discovery.dnssd
To use SSDP, declare the following feature requirements in the config file: http://tizen.org/feature/network.service_discovery.ssdp
Interfaces
INsdBrowser
This interface is used for managing the network service discovery using DNS-SD/SSDP.
INsdService
This interface is used for managing the local service registration using DNS-SD/SSDP.
Enums
DnssdServiceState
Enumeration for the DNS-SD service states.
SsdpServiceState
Enumeration for the SSDP service states.