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.
C#Copypublic class DnssdService : INsdService, IDisposable
- Inheritance
-
System.ObjectDnssdService
- Implements
-
System.IDisposable
Constructors
DnssdService(String)
The constructor to create the DnssdService instance that sets the serviceType to a given value.
Declaration
C#Copypublic DnssdService(string serviceType)
Parameters
Type | Name | Description |
---|---|---|
System.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 |
---|---|
System.NotSupportedException | Thrown while setting this property when DNS-SD is not supported. |
System.ArgumentException | Thrown when the serviceType is set to null. |
API Level: 4
Feature: http://tizen.org/feature/network.service_discovery.dnssd
Properties
Declaration
C#Copypublic 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
Declaration
C#Copypublic string Name { get; set; }
Property Value
Type | Description |
---|---|
System.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 |
---|---|
System.NotSupportedException | Thrown while setting this property when DNS-SD is not supported. |
System.ArgumentException | Thrown when the name value is set to null. |
System.InvalidOperationException | Thrown while setting this property when any other error occurred. |
API Level: 4
Feature: http://tizen.org/feature/network.service_discovery.dnssd
Declaration
C#Copypublic 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 |
---|---|
System.NotSupportedException | Thrown while setting this property when DNS-SD is not supported. |
System.ArgumentException | Thrown if the value of port is set to less than 0 or more than 65535. |
System.InvalidOperationException | Thrown while setting this property when any other error occurred. |
API Level: 4
Feature: http://tizen.org/feature/network.service_discovery.dnssd
Declaration
C#Copypublic string Type { get; }
Property Value
Type | Description |
---|---|
System.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
Declaration
C#Copypublic void AddTXTRecord(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.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. |
System.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 |
---|---|
System.NotSupportedException | Thrown when DNS-SD is not supported. |
System.ArgumentException | Thrown when the value of the key is null. |
System.InvalidOperationException | Thrown when any other error occurred. |
API Level: 4
Feature: http://tizen.org/feature/network.service_discovery.dnssd
Declaration
C#Copypublic void DeregisterService()
Remarks
A local service registered using RegisterService() must be passed.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when any other error occurred. |
System.NotSupportedException | Thrown when DNS-SD is not supported. |
API Level: 4
Feature: http://tizen.org/feature/network.service_discovery.dnssd
Declaration
C#Copypublic void Dispose()
API Level: 4
Declaration
C#Copyprotected void Finalize()
Declaration
C#Copypublic byte[] GetRawTXTRecords()
Returns
Type | Description |
---|---|
System.Byte[] | Returns empty bytes array in case TXT record has not been set, else returns raw TXT record. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when DNS-SD is not supported. |
System.InvalidOperationException | Thrown when any other error occurred. |
API Level: 9
Feature: http://tizen.org/feature/network.service_discovery.dnssd
Declaration
C#Copypublic void RegisterService()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when any other error occurred. |
System.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
Declaration
C#Copypublic void RemoveTXTRecord(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the TXT record to be removed. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when DNS-SD is not supported. |
System.ArgumentException | Thrown when the value of the key is null. |
System.InvalidOperationException | Thrown when any other error occurred. |