MDNSServiceType

value class MDNSServiceType(val value: String)

Platform-neutral mDNS service-type wrapper.

Holds the canonical base form — e.g. "_myapp._tcp" — and normalizes to each mDNS API's required format internally. Callers never need to know which suffix a given platform expects.

Canonical form

Pass the service type without any trailing dot or .local. suffix:

MDNSServiceType("_myapp._tcp")

Per-platform normalization

PlatformAPIRequired formatMethod
JVMJmDNS"_myapp._tcp.local."forJmDns
AndroidNsdManager"_myapp._tcp."forNsd
iOS / macOSNSNetServiceBrowser"_myapp._tcp."forNsNetServiceBrowser

The normalization strips any existing suffix before appending the expected one, so callers that accidentally pass a pre-suffixed string still get a correct result.

Constructors

Link copied to clipboard
constructor(value: String)

Properties

Link copied to clipboard

The canonical base form (e.g. "_myapp._tcp").

Functions

Link copied to clipboard

Returns the service type in JmDNS format: "_myapp._tcp.local.".

Link copied to clipboard
fun forNsd(): String

Returns the service type in NsdManager format: "_myapp._tcp.".

Link copied to clipboard

Returns the service type in NSNetServiceBrowser format: "_myapp._tcp.".