Note: This tutorial assumes that you have completed the previous tutorials: Understanding Service Types.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Publishing Services

Description: Illustrates how to use the zeroconf_jmdns api to publish services.

Keywords: zeroconf, jmdns

Tutorial Level: INTERMEDIATE

Next Tutorial: Service Discovery via Polling

Code

Publishing is very straightforward. The following explicitly details each element required to publish a ros master.

   1 // imports
   2 import com.github.ros_java.zeroconf_jmdns_suite.jmdns.Zeroconf;
   3 import com.github.ros_java.zeroconf_jmdns_suite.jmdns.StandardLogger;
   4 
   5 // and in your code
   6 Zeroconf publisher = new Zeroconf(new StandardLogger());
   7 publisher.addService("DudeMaster", "_ros-master._tcp", "local", 8888, "Dude's test master");

For ros master services in particular, we could pull ros information directly from rosjava to fill out some of the above details - if you have an interest in getting this implemented contact <d DOT stonier AT gmail DOT com>.

Example

Example code can be found in the jmdns tutorials.

Wiki: zeroconf_jmdns_suite/Tutorials/common/Publishing Services (last edited 2016-12-26 02:39:10 by DanielStonier)