$search
00001 package ros.zeroconf.jmdns.demos; 00002 00003 import java.io.IOException; 00004 import ros.zeroconf.jmdns.Zeroconf; 00005 import ros.zeroconf.jmdns.StandardLogger; 00006 00007 public class Publisher { 00008 00009 public static void main_publisher(String argv[]) throws IOException { 00010 Zeroconf publisher = new Zeroconf(new StandardLogger()); 00011 System.out.println("Publishing DudeMaster for 8 seconds, then removing"); 00012 publisher.addService("DudeMaster", "_ros-master._tcp", "local", 8888, "Dude's test master"); 00013 int i = 0; 00014 while(true) { 00015 try { 00016 Thread.sleep(1000L); 00017 } catch (InterruptedException e) { 00018 e.printStackTrace(); 00019 } 00020 ++i; 00021 if ( i == 8 ) { 00022 publisher.removeAllServices(); 00023 } 00024 } 00025 } 00026 }