DnssdServiceInstance DnssdServiceInstance DnssdServiceInstance DnssdServiceInstance Class

Definition

Encapsulates an instance of a service that uses DNS Service Discovery (DNS-SD).

public : sealed class DnssdServiceInstance : IStringable, IDnssdServiceInstancepublic sealed class DnssdServiceInstance : IStringable, IDnssdServiceInstancePublic NotInheritable Class DnssdServiceInstance Implements IStringable, IDnssdServiceInstance// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Use this class if you are providing a service that advertises itself to other DNS-SD users, or if you are consuming services advertised via DNS-SD.

If your code attempts to register a service instance with the same name as a previously-registered service, your service will be renamed to avoid a conflict by adding a number in parentheses at the end of the name you specified. For example, if you specified "mygame" and that name was already registered for another service, your service would be renamed to something like, "mygame (2)". When this is done, DnssdRegistrationResult.HasInstanceNameChanged is set to true.

Constructors

DnssdServiceInstance(String, HostName, UInt16) DnssdServiceInstance(String, HostName, UInt16) DnssdServiceInstance(String, HostName, UInt16) DnssdServiceInstance(String, HostName, UInt16)

Creates a new DnssdServiceInstance object with the specified instance name, host name, and port.

public : DnssdServiceInstance(PlatForm::String dnssdServiceInstanceName, HostName hostName, unsigned short port)public DnssdServiceInstance(String dnssdServiceInstanceName, HostName hostName, UInt16 port)Public Sub New(dnssdServiceInstanceName As String, hostName As HostName, port As UInt16)// You can use this method in JavaScript.
Parameters
dnssdServiceInstanceName
PlatForm::String String String String

The service instance name for the service instance being created.

hostName
HostName HostName HostName HostName

The hostname for the service instance being created.

port
unsigned short UInt16 UInt16 UInt16

The port number for the service instance being created.

Properties

DnssdServiceInstanceName DnssdServiceInstanceName DnssdServiceInstanceName DnssdServiceInstanceName

Gets or sets the DNS-SD service instance name for this DnssdServiceInstance.

public : PlatForm::String DnssdServiceInstanceName { get; set; }public string DnssdServiceInstanceName { get; set; }Public ReadWrite Property DnssdServiceInstanceName As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The name of the service.

HostName HostName HostName HostName

Gets or sets the hostname of the host for this DnssdServiceInstance.

public : HostName HostName { get; set; }public HostName HostName { get; set; }Public ReadWrite Property HostName As HostName// You can use this property in JavaScript.
Value
HostName HostName HostName HostName

The name of the host, encapuslated in a HostName instance.

Port Port Port Port

Gets or sets the port number used by this DnssdServiceInstance.

public : ushort Port { get; set; }public ushort Port { get; set; }Public ReadWrite Property Port As ushort// You can use this property in JavaScript.
Value
ushort ushort ushort ushort

The port number used by this service instance.

Priority Priority Priority Priority

Gets or sets the priority value to assign to this service instance, as defined in RFC 2782. Clients use Priority to decide which of several equivalent service instances to attach to.

public : ushort Priority { get; set; }public ushort Priority { get; set; }Public ReadWrite Property Priority As ushort// You can use this property in JavaScript.
Value
ushort ushort ushort ushort

The priority value for this service instance. See RFC 2782 for details on how clients use this value.

TextAttributes TextAttributes TextAttributes TextAttributes

Gets the attributes of this service instance, as a list of [name, value] pairs of strings. Attributes can be inspected by service clients to determine additional information about a service instance.

The specific attribute names and values used by a service are determined by the designer of the service. For example, a service instance for a multiplayer game might have attributes describing which game map the instance is using, or the game difficulty level of the instance. Different service instances would be active for different maps or difficulty levels, and a client using the game service could use the attribute values to determine which game server instance to connect to for the player's preferred map or difficulty level.

public : IMap<string, string> TextAttributes { get; }public IDictionary<string, string> TextAttributes { get; }Public ReadOnly Property TextAttributes As IDictionary<string, string>// You can use this property in JavaScript.
Value
IMap<PlatForm::String, PlatForm::String> IDictionary<string, string> IDictionary<string, string> IDictionary<string, string>

A collection of attribute [name,value] pairs.

Weight Weight Weight Weight

Gets or sets the weight value assigned to this service instance, as defined in RFC 2782. Clients use the Weight value to choose between servers with the same Priority value.

public : ushort Weight { get; set; }public ushort Weight { get; set; }Public ReadWrite Property Weight As ushort// You can use this property in JavaScript.
Value
ushort ushort ushort ushort

The weight value for this service instance. See RFC 2782 for details on how clients use this value.

Methods

RegisterDatagramSocketAsync(DatagramSocket) RegisterDatagramSocketAsync(DatagramSocket) RegisterDatagramSocketAsync(DatagramSocket) RegisterDatagramSocketAsync(DatagramSocket)

Asynchronously registers a datagram (UDP) socket listener for the service, on a given socket.

public : IAsyncOperation<DnssdRegistrationResult> RegisterDatagramSocketAsync(DatagramSocket socket)public IAsyncOperation<DnssdRegistrationResult> RegisterDatagramSocketAsync(DatagramSocket socket)Public Function RegisterDatagramSocketAsync(socket As DatagramSocket) As IAsyncOperation( Of DnssdRegistrationResult )// You can use this method in JavaScript.
Parameters
socket
DatagramSocket DatagramSocket DatagramSocket DatagramSocket

Describes the socket that this service instance uses to listen for new service clients.

Returns

On successful completion of the asynchronous operation, returns an object describing the results of registration.

See Also

RegisterDatagramSocketAsync(DatagramSocket, NetworkAdapter) RegisterDatagramSocketAsync(DatagramSocket, NetworkAdapter) RegisterDatagramSocketAsync(DatagramSocket, NetworkAdapter) RegisterDatagramSocketAsync(DatagramSocket, NetworkAdapter)

Asynchronously registers a datagram (UDP) socket listener for the service, on a given socket and network adapter.

public : IAsyncOperation<DnssdRegistrationResult> RegisterDatagramSocketAsync(DatagramSocket socket, NetworkAdapter adapter)public IAsyncOperation<DnssdRegistrationResult> RegisterDatagramSocketAsync(DatagramSocket socket, NetworkAdapter adapter)Public Function RegisterDatagramSocketAsync(socket As DatagramSocket, adapter As NetworkAdapter) As IAsyncOperation( Of DnssdRegistrationResult )// You can use this method in JavaScript.
Parameters
socket
DatagramSocket DatagramSocket DatagramSocket DatagramSocket

Describes the socket that this service instance uses to listen for new service clients.

adapter
NetworkAdapter NetworkAdapter NetworkAdapter NetworkAdapter

Specifies the network adapter this service uses to listen for new service clients.

Returns

On successful completion of the asynchronous operation, returns an object describing the results of registration.

See Also

RegisterStreamSocketListenerAsync(StreamSocketListener) RegisterStreamSocketListenerAsync(StreamSocketListener) RegisterStreamSocketListenerAsync(StreamSocketListener) RegisterStreamSocketListenerAsync(StreamSocketListener)

Asynchronously registers a stream (TCP) socket listener for the service, on the given socket.

public : IAsyncOperation<DnssdRegistrationResult> RegisterStreamSocketListenerAsync(StreamSocketListener socket)public IAsyncOperation<DnssdRegistrationResult> RegisterStreamSocketListenerAsync(StreamSocketListener socket)Public Function RegisterStreamSocketListenerAsync(socket As StreamSocketListener) As IAsyncOperation( Of DnssdRegistrationResult )// You can use this method in JavaScript.
Parameters
socket
StreamSocketListener StreamSocketListener StreamSocketListener StreamSocketListener

Describes the socket that this service instance uses to listen for new service clients.

Returns

On successful completion of the asynchronous operation, returns an object describing the results of registration.

See Also

RegisterStreamSocketListenerAsync(StreamSocketListener, NetworkAdapter) RegisterStreamSocketListenerAsync(StreamSocketListener, NetworkAdapter) RegisterStreamSocketListenerAsync(StreamSocketListener, NetworkAdapter) RegisterStreamSocketListenerAsync(StreamSocketListener, NetworkAdapter)

Asynchronously registers a stream (TCP) socket listener for the service, on the given socket and network adapter.

public : IAsyncOperation<DnssdRegistrationResult> RegisterStreamSocketListenerAsync(StreamSocketListener socket, NetworkAdapter adapter)public IAsyncOperation<DnssdRegistrationResult> RegisterStreamSocketListenerAsync(StreamSocketListener socket, NetworkAdapter adapter)Public Function RegisterStreamSocketListenerAsync(socket As StreamSocketListener, adapter As NetworkAdapter) As IAsyncOperation( Of DnssdRegistrationResult )// You can use this method in JavaScript.
Parameters
socket
StreamSocketListener StreamSocketListener StreamSocketListener StreamSocketListener

Describes the socket that this service instance uses to listen for new service clients.

adapter
NetworkAdapter NetworkAdapter NetworkAdapter NetworkAdapter

Specifies the network adapter this service uses to listen for new service clients.

Returns

On successful completion of the asynchronous operation, returns an object describing the results of registration.

See Also

ToString() ToString() ToString() ToString()

Gets the DNS Server Resource Record (SRV RR) of this service instance, as a string.

See RFC 1034 for the format and contents of the DNS SRV RR, and RFC 2782 and RFC 6763 for details about how DNS-SD clients and servers use those records.

public : PlatForm::String ToString()public string ToString()Public Function ToString() As string// You can use this method in JavaScript.
Returns
PlatForm::String string string string

The DNS Server Resource Record of this server instance.