This commit is contained in:
2025-09-29 06:30:39 +08:00
parent 20c229bfb7
commit 5e692bac6c
7 files changed
+138 -66

No files matched your search

+21 -16
View File
@@ -1,9 +1,9 @@
# native-mdns
A Kotlin multiplatform library for mdns announcer(mdns server), only broadcast is supported,
it depends on ktor-network
it depends on ktor-network.
support PTR.
Also, nmdns can be compiled to shared/static lib for other language usage, see [build.gradle.kts](build.gradle.kts)
Supported platforms:
1. windows64(mingwx64)
@@ -12,6 +12,11 @@ Supported platforms:
4. macosArm64
5. jvm(11 or later)
Supported srv type
1. A
2. PTR
> AAAA is not supported
AirPlay2(_airplay._tcp.local.) is tested
@@ -35,7 +40,7 @@ kotlin {
sourceSets {
commonMain.dependencies {
implementation("cn.rtast.nmdns:native-mdns:0.0.1")
implementation("cn.rtast.nmdns:native-mdns:0.0.2")
}
}
}
@@ -44,17 +49,17 @@ kotlin {
There is a simple airplay2 service
```kotlin
val service = createService(
serviceType = "_airplay._tcp.local.",
serviceName = "AP@RTAST",
hostname = "rtakland.local.",
ipAddress = "192.168.10.104",
port = 7001,
bindAddress = "192.168.10.104",
mdnsPort = 5356,
)
while (true) {
service.broadcast()
delay(2000L)
}
val service = registerService(
serviceType = "_airplay._tcp.local.",
serviceName = "AP@RTAST",
hostname = "rtakland.local.",
ipAddress = "192.168.10.104",
port = 7001,
bindAddress = "192.168.10.104",
mdnsPort = 5356,
)
while (true) {
service.broadcast()
delay(2000L) // or use cn.rtast.nmdns.sleep1(2) sleep 2 seconds
}
```