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 java.io.IOException;
00019 
00020 import com.github.rosjava.zeroconf_jmdns_suite.jmdns.StandardLogger;
00021 import com.github.rosjava.zeroconf_jmdns_suite.jmdns.Zeroconf;
00022 
00023 public class Publisher {
00024         
00025         public static void main_publisher() throws IOException {
00026         Zeroconf publisher = new Zeroconf(new StandardLogger());
00027         System.out.println("Publishing DudeMaster for 8 seconds, then removing");
00028         publisher.addService("DudeMaster", "_ros-master._tcp", "local", 8888, "Dude's test master");
00029         int i = 0;
00030         while(true) {
00031                 try {
00032                         Thread.sleep(1000L);
00033                     } catch (InterruptedException e) {
00034                         e.printStackTrace();
00035                     }
00036                 ++i;
00037                 if ( i == 8 ) {
00038                         publisher.removeAllServices();
00039                 }
00040         }
00041     }
00042 }