Class DnssdService
Definition
- Assembly:
- Tizen.Network.Nsd.dll
This class is used for managing the local service registration and its properties using DNS-SD.
public class DnssdService : INsdService, IDisposable
- Inheritance
-
objectDnssdService
- Implements
-
System.IDisposable
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 |
---|---|
System.NotSupportedException | Thrown while setting this property when DNS-SD is not supported. |
System.ArgumentException | Thrown when the serviceType is set to null. |
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.
Name
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 |
---|---|
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. |
Port
Port number of the DNS-SD local or remote service.
Declaration
public int Port { get; set; }
Property Value
Type | Description |
---|---|
int |
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. |
Type
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.
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 |
---|---|
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. |
DeregisterService()
Deregisters the DNS-SD local service.
Declaration
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. |
Dispose()
Disposes the memory allocated to unmanaged resources.
Declaration
public void Dispose()
~DnssdService()
Destroys the DnssdService object.
Declaration
protected ~DnssdService()
RegisterService()
Registers the DNS-SD local service for publishing.
Declaration
public void RegisterService()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when any other error occurred. |
System.NotSupportedException | Thrown when DNS-SD is not supported. |
System.UnauthorizedAccessException | Thrown when the permission is denied. |
RemoveTXTRecord(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 |
---|---|
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. |