0

How to get description string of jmDNS ServiceInfo whitch we specify in 4 parameters of this overload:

ServiceInfo mServiceInfo = ServiceInfo.create(TYPE, SERVICE_NAME, PORT, DESCRIPTION);

What method can I get value from DESCRIPTION variable of this instance.

Thanks in advance, regards...)

1 Answer 1

1

The following website has the documentation for the ServiceInfo class. http://jmdns.sourceforge.net/apidocs/javax/jmdns/ServiceInfo.html

The method you're looking for is ServiceInfo.getNiceTextString(), which "Returns a description of the service info suitable for printing." This method returns the entire DESCRIPTION variable in a printable string. You can also use the getPropertyNames() method with the getPropertyBytes(String name) or getPropertyString(String name) methods to get specific TXT entries and their values. For instance, if your DESCRIPTION variable is "color=blue" then you can call ServiceInfo.getPropertyString("color") and it will return "blue".

Not the answer you're looking for? Browse other questions tagged or ask your own question.