1

I want to use JmDNS lib to implement bonjour on Android:
Below s my code:

    private String type1 = "_adisk._tcp.";
    private String type2 = "_workstation._tcp.local.";
    private String type3 = "_smb._tcp.local.";
    private String type4 = "_http._tcp.local.";
    private String type5 = "_afpovertcp._tcp.local.";
try {
    jmdns = JmDNS.create();
    ddServiceListener(type, listener = new ServiceListener() {
        public void serviceResolved(ServiceEvent ev) {
            System.out.println("Service resolved: "
            + ev.getInfo().getQualifiedName()
        + " port:" + ev.getInfo().getPort());
        }
        public void serviceRemoved(ServiceEvent ev) {
        }
    public void serviceAdded(ServiceEvent event) {
        jmdns.requestServiceInfo(event.getType(), event.getName(), 1);
    }
    });
}
catch(Exception e) {
    e.printStackTrace();
}

It only works on the workstation type.
Others are not found any one.
But I try use app ZeroConf Browser can find on the same environment.
How can I modify it?

dakshbhatt21
  • 3,558
  • 3
  • 31
  • 40
brian
  • 6,802
  • 29
  • 83
  • 124

0 Answers0