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#
Copy
public class DnssdService : INsdService, IDisposable
Inheritance
System.Object
DnssdService
Implements
System.IDisposable

Constructors

View Source

DnssdService(String)

The constructor to create the DnssdService instance that sets the serviceType to a given value.

Declaration
C#
Copy
public 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

View Source

IP

IP address of the DNS-SD remote service.

Declaration
C#
Copy
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 Source

Name

Name of the DNS-SD service.

Declaration
C#
Copy
public 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
View Source

Port

Port number of the DNS-SD local or remote service.

Declaration
C#
Copy
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
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
View Source

Type

Type of the DNS-SD local or remote service.

Declaration
C#
Copy
public 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

View Source

AddTXTRecord(String, String)

Adds the TXT record.

Declaration
C#
Copy
public 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
View Source

DeregisterService()

Deregisters the DNS-SD local service.

Declaration
C#
Copy
public 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
View Source

Dispose()

Disposes the memory allocated to unmanaged resources.

Declaration
C#
Copy
public void Dispose()
API Level: 4
View Source

Finalize()

Destroys the DnssdService object.

Declaration
C#
Copy
protected void Finalize()
View Source

GetRawTXTRecords()

Returns raw TXT records.

Declaration
C#
Copy
public 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
View Source

RegisterService()

Registers the DNS-SD local service for publishing.

Declaration
C#
Copy
public 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
View Source

RemoveTXTRecord(String)

Removes the TXT record.

Declaration
C#
Copy
public 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.

API Level: 4
Feature: http://tizen.org/feature/network.service_discovery.dnssd

Implements

System.IDisposable