Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 package com.github.rosjava.zeroconf_jmdns_suite.jmdns.tutorials;
00017
00018 import com.github.rosjava.zeroconf_jmdns_suite.jmdns.DiscoveredService;
00019 import com.github.rosjava.zeroconf_jmdns_suite.jmdns.ZeroconfDiscoveryHandler;
00020
00027 public class DiscoveryHandler implements ZeroconfDiscoveryHandler {
00028
00029 public void serviceAdded(DiscoveredService discovered_service) {
00030 String result = "[+] " + discovered_service.name + "." + discovered_service.type + "." + discovered_service.domain + ".";
00031 System.out.println(result);
00032 }
00033 public void serviceRemoved(DiscoveredService discovered_service) {
00034 String result = "[-] " + discovered_service.name + "." + discovered_service.type + "." + discovered_service.domain + ".";
00035 System.out.println(result);
00036 }
00037 public void serviceResolved(DiscoveredService discovered_service) {
00038 String result = "[=] " + discovered_service.name + "." + discovered_service.type + "." + discovered_service.domain + ".\n";
00039 result += " Port : " + discovered_service.port + "\n";
00040 result += " Hostname : " + discovered_service.hostname + "\n";
00041 for ( String address : discovered_service.ipv4_addresses ) {
00042 result += " Address: " + address + "\n";
00043 }
00044 for ( String address : discovered_service.ipv6_addresses ) {
00045 result += " Address: " + address + "\n";
00046 }
00047 System.out.printf(result);
00048 }
00049 }