You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my specific use case I need to both listen mdns packages of my devices in the network and at the same time announce my application to the network. When I do this:
import net.posick.mdns.*
import org.xbill.DNS.Message
import org.xbill.DNS.Name
fun main() {
val mDNSService = MulticastDNSService()
val deviceListener = object : DNSSDListener {
override fun serviceDiscovered(id: Any, service: ServiceInstance) {
println("serviceDiscovered $service")
}
override fun serviceRemoved(id: Any, service: ServiceInstance) {
println("serviceRemoved $service")
}
override fun receiveMessage(id: Any, m: Message) {
println("receiveMessage $m")
}
override fun handleException(id: Any, ex: Exception) {
ex.printStackTrace()
}
}
val service = ServiceInstance(
ServiceName("myservice._http._tcp.local."),
0,
0,
8443,
Name.fromString("myservice._http._tcp.local."),
)
mDNSService.startServiceDiscovery(Browse("_device-id._tcp.local."), deviceListener)
println("Announcing my service $service")
mDNSService.register(service)
}
I am getting a StackOverflowError
Announcing my service Service ("myservice._http._tcp.local." can be reached at "myservice._http._tcp.local." [---] on port 8443)
Exception in thread "main" java.lang.StackOverflowError
at java.base/jdk.internal.reflect.Reflection.verifyMemberAccess(Reflection.java:141)
at java.base/java.lang.reflect.AccessibleObject.slowVerifyAccess(AccessibleObject.java:715)
at java.base/java.lang.reflect.AccessibleObject.verifyAccess(AccessibleObject.java:701)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:673)
at java.base/java.lang.reflect.Method.invoke(Method.java:560)
at org.xbill.DNS.MulticastDNSUtils.getTargetFromRecord(MulticastDNSUtils.java:219)
at net.posick.mdns.MulticastDNSCache.queryCacheForAdditionalRecords(MulticastDNSCache.java:331)
at net.posick.mdns.MulticastDNSCache.queryCacheForAdditionalRecords(MulticastDNSCache.java:338)
at net.posick.mdns.MulticastDNSCache.queryCacheForAdditionalRecords(MulticastDNSCache.java:338)
at net.posick.mdns.MulticastDNSCache.queryCacheForAdditionalRecords(MulticastDNSCache.java:338)
...
What am I doing wrong here?
The text was updated successfully, but these errors were encountered:
In case anyone else bumps into a similar issue, this seems to be gone when I change my service to this:
val service = ServiceInstance(
ServiceName("myservice._http._tcp.local."),
0,
0,
8443,
Name.fromString("myservice."), // instead of "myservice._http._tcp.local."
)
In my specific use case I need to both listen mdns packages of my devices in the network and at the same time announce my application to the network. When I do this:
I am getting a StackOverflowError
What am I doing wrong here?
The text was updated successfully, but these errors were encountered: