Class DnssdService
Definition
- Namespace:
- Tizen.Network.Nsd
- Assembly:
- Tizen.Network.Nsd.dll
- API Level:
- 4
This class is used for managing the local service registration and its properties using DNS-SD.
public class DnssdService : INsdService, IDisposable
- Inheritance
-
DnssdService
- Implements
Constructors
View SourceDnssdService(String)
The constructor to create the DnssdService instance that sets the serviceType to a given value.
Declaration
public DnssdService(string serviceType)
Parameters
Type | Name | Description |
---|---|---|
String | serviceType | The DNS-SD service type. It is expressed as a type followed by the protocol, separated by a dot (For example, "_ftp._tcp"). It must begin with an underscore followed by 1-15 characters, which may be letters, digits, or hyphens. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown while setting this property when DNS-SD is not supported. |
ArgumentException | Thrown when the serviceType is set to null. |
API Level: 4
Feature: http://tizen.org/feature/network.service_discovery.dnssd
Properties
View SourceIP
IP address of the DNS-SD remote service.
Declaration
public IPAddressInformation IP { get; }
Property Value
Type | Description |
---|---|
IPAddressInformation |
Remarks
If the remote service has no IPv4 Address, then IPv4Address would contain null and if it has no IPv6 Address, then IPv6Address would contain null. In case of an error, null object will be returned.
API Level: 4
View SourceName
Name of the DNS-SD service.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
String |
Remarks
Set the name for only an unregistered service created locally. It may be up to 63 bytes. In case of an error, null will be returned during get and exception will be thrown during set.
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown while setting this property when DNS-SD is not supported. |
ArgumentException | Thrown when the name value is set to null. |
InvalidOperationException | Thrown while setting this property when any other error occurred. |
API Level: 4
Feature: http://tizen.org/feature/network.service_discovery.dnssd
View SourcePort
Port number of the DNS-SD local or remote service.
Declaration
public int Port { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
Set the port for only an unregistered service created locally. The default value of the port is 0. In case of an error, -1 will be returned during get and exception will be thrown during set.
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown while setting this property when DNS-SD is not supported. |
ArgumentException | Thrown if the value of port is set to less than 0 or more than 65535. |
InvalidOperationException | Thrown while setting this property when any other error occurred. |
API Level: 4
Feature: http://tizen.org/feature/network.service_discovery.dnssd
View SourceType
Type of the DNS-SD local or remote service.
Declaration
public string Type { get; }
Property Value
Type | Description |
---|---|
String |
Remarks
It is expressed as a type followed by the protocol, separated by a dot (For example, "_ftp._tcp"). It must begin with an underscore followed by 1-15 characters, which may be letters, digits, or hyphens. In case of an error, null will be returned.
API Level: 4
Methods
View SourceAddTXTRecord(String, String)
Adds the TXT record.
Declaration
public void AddTXTRecord(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key of the TXT record. It must be a null-terminated string with 9 characters or fewer excluding null. It is case insensitive. |
String | value | The value of the TXT record. If null, then "key" will be added with no value. If non-null but the value_length is zero, then "key=" will be added with an empty value. |
Remarks
TXT record should be added after registering the local service using RegisterService().
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown when DNS-SD is not supported. |
ArgumentException | Thrown when the value of the key is null. |
InvalidOperationException | Thrown when any other error occurred. |
API Level: 4
Feature: http://tizen.org/feature/network.service_discovery.dnssd
View SourceDeregisterService()
Deregisters the DNS-SD local service.
Declaration
public void DeregisterService()
Remarks
A local service registered using RegisterService() must be passed.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when any other error occurred. |
NotSupportedException | Thrown when DNS-SD is not supported. |
API Level: 4
Feature: http://tizen.org/feature/network.service_discovery.dnssd
View SourceDispose()
Disposes the memory allocated to unmanaged resources.
Declaration
public void Dispose()
API Level: 4
View SourceFinalize()
Destroys the DnssdService object.
Declaration
protected void Finalize()
RegisterService()
Registers the DNS-SD local service for publishing.
Declaration
public void RegisterService()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when any other error occurred. |
NotSupportedException | Thrown when DNS-SD is not supported. |
UnauthorizedAccessException | Thrown when the permission is denied. |
API Level: 4
Privilege Level: public
Privilege: http://tizen.org/privilege/internet
Feature: http://tizen.org/feature/network.service_discovery.dnssd
View SourceRemoveTXTRecord(String)
Removes the TXT record.
Declaration
public void RemoveTXTRecord(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key of the TXT record to be removed. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown when DNS-SD is not supported. |
ArgumentException | Thrown when the value of the key is null. |
InvalidOperationException | Thrown when any other error occurred. |