Open Grizmol opened 4 years ago
When service is registered on VPN connected, no service is visible.
Sample code to reproduce error
package com.company; import java.io.IOException; import java.net.InetAddress; import java.util.HashMap; import java.util.Map; import javax.jmdns.JmDNS; import javax.jmdns.ServiceInfo; public class Main { public static void main(String[] args) { try { System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "TRACE"); // Wait a bit String serviceType = "_testservice._tcp.local."; JmDNS jmdns = JmDNS.create(); ServiceInfo discoveryServiceInfo = getDiscoveryServiceInfo(serviceType); jmdns.registerService(discoveryServiceInfo); System.out.println("Press q and Enter, to quit"); int b; while ((b = System.in.read()) != -1 && (char) b != 'q') { } jmdns.unregisterAllServices(); jmdns.close(); System.out.println("Done"); } catch (IOException e) { System.out.println(e.getMessage()); } } private static ServiceInfo getDiscoveryServiceInfo(String serviceType) { // Register a service Map<String, String> discoveryData = new HashMap<>(); discoveryData.put("TestKey", "TestValue"); return ServiceInfo.create(serviceType, "TestService", 20480, 1, 1, discoveryData); } }
Expected result Add record should be visible when typing in terminal: dns-sd -B _testservice
dns-sd -B _testservice
Actual error There is no record visible when connected to vpn.
Additional info When registering a service with
dns-sd -R "Test service instance" _testservice._tcp local 30
everything works fine. Not every VPN causes this issue. Creating same service data with alternative javascript library also works correct.
Environment jmdns : 3.5.5 macOS: Mojave 10.14.6 (18G103) vpn client: Pulse Secure
I am pretty sure JmDNS jmdns = JmDNS.create(); you need to use the overloaded create() to pass the IP address or you want to scan because once you have a VPN you now have multiple Network Adapters.
JmDNS jmdns = JmDNS.create();
create()
When service is registered on VPN connected, no service is visible.
Sample code to reproduce error
Expected result Add record should be visible when typing in terminal:
dns-sd -B _testservice
Actual error There is no record visible when connected to vpn.
Additional info When registering a service with
dns-sd -R "Test service instance" _testservice._tcp local 30
everything works fine. Not every VPN causes this issue. Creating same service data with alternative javascript library also works correct.
Environment jmdns : 3.5.5 macOS: Mojave 10.14.6 (18G103) vpn client: Pulse Secure