Class ZeroConfService

java.lang.Object
jmri.util.zeroconf.ZeroConfService

public class ZeroConfService
extends Object
ZeroConfService objects manage a zeroConf network service advertisement.

ZeroConfService objects encapsulate zeroConf network services created using JmDNS, providing methods to start and stop service advertisements and to query service state. Typical usage would be:

 ZeroConfService myService = ZeroConfService.create("_withrottle._tcp.local.", port);
 myService.publish();
 
or, if you do not wish to retain the ZeroConfService object:
 ZeroConfService.create("_http._tcp.local.", port).publish();
 
ZeroConfService objects can also be created with a HashMap of properties that are included in the TXT record for the service advertisement. This HashMap should remain small, but it could include information such as the default path (for a web server), a specific protocol version, or other information. Note that all service advertisements include the JMRI version, using the key "version", and the JMRI version numbers in a string "major.minor.test" with the key "jmri"

All ZeroConfServices are published with the computer's hostname as the mDNS hostname (unless it cannot be determined by JMRI), as well as the JMRI node name in the TXT record with the key "node".

All ZeroConfServices are automatically stopped when the JMRI application shuts down. Use ZeroConfServiceManager.allServices() to get a collection of all published ZeroConfService objects.


This file is part of JMRI.

JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

See Also:
JmDNS, ServiceInfo